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
All checks were successful
BotServer CI / build (push) Successful in 3m53s
This commit is contained in:
parent
adb26330d2
commit
363c056bab
1 changed files with 3 additions and 2 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue