Skip to content
Clone

fix: disable redis response timeout for blocking commands

Blocking reads such as XREADGROUP BLOCK can legitimately outlive the
redis-rs default 500ms response timeout, which made long polls fail.
Align the multiplexed connection settings with the plain connection path
and disable the response timeout.
ZhenYi committed
parent c8e7827 commit 7735071 Browse files

1 file changed

+5 −2

Modified lib/infra/cache/src/conn.rs View lib/infra/cache/src/conn.rs
@@ -71,8 +71,11 @@
7171 .ok_or_else(|| CacheError::config("redis requires at least one node"))?;
7272 let node_info = connection_info(url, cfg)?;
7373 let client = redis::Client::open(node_info.clone()).map_err(CacheError::from)?;
74 let manager_config =
75 ConnectionManagerConfig::new().set_connection_timeout(Some(cfg.create_timeout()));
74 // 阻塞命令(如 XREADGROUP BLOCK)的耗时会超过 redis-rs 默认的 500ms
75 // 响应超时,这里与 get_multiplexed_async_connection_with_config 保持一致。
76 let manager_config = ConnectionManagerConfig::new()
77 .set_connection_timeout(Some(cfg.create_timeout()))
78 .set_response_timeout(None);
7679
7780 let mut connections = Vec::with_capacity(pool_size);
7881 for _ in 0..pool_size {