Skip to content

Commit

Permalink
Consider a connection issue a transient one
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsnaps committed Apr 22, 2024
1 parent 9d5eed7 commit 3b346a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion limitador/src/storage/redis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ impl From<RedisError> for StorageErr {
fn from(e: RedisError) -> Self {
Self {
msg: e.to_string(),
transient: e.is_timeout() || e.is_connection_dropped() || e.is_cluster_error(),
transient: e.is_timeout()
|| e.is_connection_dropped()
|| e.is_cluster_error()
|| e.is_connection_refusal(),
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions limitador/src/storage/redis/redis_cached.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,10 @@ impl CachedRedisStorage {
.expect("This couldn't fail in the past, yet now it did somehow!"),
2,
100,
6,
1,
response_timeout,
Duration::from_secs(5),
// TLS handshake might result in an additional 2 RTTs to Redis, adding some headroom as well
(response_timeout * 3) + Duration::from_millis(50),
)
.await?;

Expand Down

0 comments on commit 3b346a2

Please sign in to comment.