From b8025de67be7c9bea0868d4163ffa65d6a5cbcfe Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Fri, 28 Jul 2023 10:39:40 +0200 Subject: [PATCH] add a timeout to redis queries --- apollo-router/src/cache/redis.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apollo-router/src/cache/redis.rs b/apollo-router/src/cache/redis.rs index db9fbf25dd7..2caf54b36e9 100644 --- a/apollo-router/src/cache/redis.rs +++ b/apollo-router/src/cache/redis.rs @@ -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; @@ -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();