-
Notifications
You must be signed in to change notification settings - Fork 104
feat(redis): Add response timeout #5329
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
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| /// An error that occurs when configuring Redis. | ||
| #[error("failed to configure redis: {0}")] | ||
| ConfigError(#[from] ConfigError), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variant and From impl were already unused.
relay-redis/src/config.rs
Outdated
| /// will fail with a timeout error. This setting helps prevent indefinite | ||
| /// blocking when the pool is exhausted. | ||
| pub wait_timeout: Option<u64>, | ||
| pub connection_timeout: Option<u64>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is arguably redundant with create_timeout: This timeout is used during connection creation in the redis crate, whereas create_timeout is used in the Managers' implementations of create. Both have the effect of putting a time limit on establishing a connection, but one is at the redis level and one at the deadpool level.
|
Updates:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice, only there seems to be a merge conflict in the Changelog.
This adds connection and respnose timeout config options for both Single and Cluster Redis clients. Unfortunately, since `redis` and `deadpool-redis` don't provide enough knobs to tweak the default clients, the easiest way to accomplish this is by more or less reinventing `deadpool_redis::Manager` and `deadpool_redis::Cluster::Manager`, but with timeouts applied. Consequently the `deadpool_redis` dependency becomes unused. TBD: default values and docstrings for the new timeouts.
5a27321 to
947d4dc
Compare
| create_timeout: Some(3), | ||
| recycle_timeout: Some(2), | ||
| wait_timeout: None, | ||
| response_timeout: Some(6), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems very low for the total command time, how did you arrive at this number?
I suspect that some cardinality limiting commands take longer than this.
| /// An error leads to the connection being detached if it is either unrecoverable or a timeout. | ||
| fn should_be_detached(error: &RedisError) -> bool { | ||
| error.is_unrecoverable_error() | ||
| error.is_unrecoverable_error() || error.is_timeout() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could add a small justification on to why the timeout is listed here.
| Err(deadpool::managed::RecycleError::message( | ||
| "Invalid PING response", | ||
| )) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Err(deadpool::managed::RecycleError::message( | |
| "Invalid PING response", | |
| )) | |
| Err(RecycleError::message("Invalid PING response")) |
RecycleError is already imported.
This adds connection and respnose timeout config options for both Single and Cluster Redis clients.
Unfortunately, since
redisanddeadpool-redisdon't provide enough knobs to tweak the default clients, the easiest way to accomplish this is by more or less reinventingdeadpool_redis::Manageranddeadpool_redis::Cluster::Manager, but with timeouts applied. Consequently thedeadpool_redisdependency becomes unused.TBD: default values and docstrings for the new timeouts.
Fixes INGEST-621.