Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow redis trigger to connect to multiple servers #2242

Merged
merged 4 commits into from
Mar 8, 2024

Conversation

karthik2804
Copy link
Contributor

Adds the ability to connect to multiple Redis servers by optionally specifying an address on the individual trigger config.

@karthik2804 karthik2804 changed the title allow redis trigger to connect to multiple servers (WIP) allow redis trigger to connect to multiple servers Jan 24, 2024
));
}

let _ = join_all(tasks).await;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should possibly exit when one of the listeners exits. thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either exit so that the alarm goes off, or try to restart the relevant listener. But yeah, I don't think we want it continuing in a partial state.

(For what it's worth I think the SQS trigger exits, but that may be because I am lazy.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the SQS trigger futures::future::select_all seems to be what I thought would work

crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
));
}

let _ = join_all(tasks).await;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the SQS trigger futures::future::select_all seems to be what I thought would work

crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@itowlson itowlson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there are any blockers here, but I feel a little uneasy about some design details (e.g. two lists of addresses, terminology) and there are a couple of wee tidying things. Have a look at the comments and if you go "Ivan you are talking nonsense because" then I am probably okay to approve.

crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
@karthik2804 karthik2804 force-pushed the allow_multiple_redis_server branch 2 times, most recently from 63e4524 to 9af352a Compare January 25, 2024 01:36
crates/redis/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@itowlson itowlson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for your patience with all the niggling

@karthik2804
Copy link
Contributor Author

cc: @lann for viz

@karthik2804 karthik2804 marked this pull request as ready for review February 10, 2024 19:25
@karthik2804 karthik2804 changed the title (WIP) allow redis trigger to connect to multiple servers allow redis trigger to connect to multiple servers Feb 10, 2024
Copy link
Collaborator

@lann lann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kinda weird but it started out kinda weird so 🤷


for (_, config) in engine.trigger_configs() {
channel_components
let address = config.address.clone().unwrap_or(default_address.clone());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make TriggerMetadata::address optional and only fail if both are missing?

Comment on lines 95 to 96
let (_, _, rest) = futures::future::select_all(tasks).await;
drop(rest);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not assigning return values implicitly drops them all.

Suggested change
let (_, _, rest) = futures::future::select_all(tasks).await;
drop(rest);
futures::future::select_all(tasks).await;

@itowlson
Copy link
Contributor

What is required to land this @karthik2804? (Apart from a rebase.) Does something need to be done with Lann's comments? (I'm not sure whether "kinda weird" is saying it needs a rework?)

@karthik2804
Copy link
Contributor Author

@lann can you clarify?

@lann
Copy link
Collaborator

lann commented Feb 21, 2024

"Kinda weird" was not useful feedback, just a vague complaint about preexisting code that I probably approved in the past 😅.

@itowlson itowlson force-pushed the allow_multiple_redis_server branch from f378750 to 473383a Compare March 8, 2024 01:33
@itowlson itowlson merged commit a8d509a into fermyon:main Mar 8, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants