Skip to content

Commit

Permalink
add a timeout to redis queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Jul 28, 2023
1 parent bdfea1d commit b8025de
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apollo-router/src/cache/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use fred::prelude::RedisError;
use fred::prelude::RedisErrorKind;
use fred::types::Expiration;
use fred::types::FromRedis;
use fred::types::PerformanceConfig;
use fred::types::ReconnectPolicy;
use fred::types::RedisConfig;
use url::Url;
Expand Down Expand Up @@ -114,8 +115,11 @@ impl RedisCacheStorage {

let client = RedisClient::new(
config,
None, //perf policy
Some(ReconnectPolicy::new_exponential(10, 1, 2000, 10)),
Some(PerformanceConfig {
default_command_timeout_ms: 1,
..Default::default()
}),
Some(ReconnectPolicy::new_exponential(10, 1, 200, 5)),
);
let _handle = client.connect();

Expand Down

0 comments on commit b8025de

Please sign in to comment.