fix(bootstrap): add strict timeout to Redis connection initialization to prevent hanging on dropped tcp packets
All checks were successful
BotServer CI / build (push) Successful in 3m53s

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-03-21 14:37:04 -03:00
parent adb26330d2
commit 363c056bab

View file

@ -296,8 +296,9 @@ pub async fn init_redis() -> Option<Arc<redis::Client>> {
let result = tokio::task::spawn_blocking(move || {
match redis::Client::open(cache_url_clone.as_str()) {
Ok(client) => {
// Verify the connection actually works
match client.get_connection() {
// Verify the connection actually works with a strict timeout to avoid hanging on DROP rules
let timeout = std::time::Duration::from_secs(3);
match client.get_connection_with_timeout(timeout) {
Ok(mut conn) => {
// Test with PING
match redis::cmd("PING").query::<String>(&mut conn) {