diff options
Diffstat (limited to 'src/libserver/redis_pool.cxx')
-rw-r--r-- | src/libserver/redis_pool.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libserver/redis_pool.cxx b/src/libserver/redis_pool.cxx index cea8d0c86..586260a6f 100644 --- a/src/libserver/redis_pool.cxx +++ b/src/libserver/redis_pool.cxx @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2025 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -465,6 +465,8 @@ auto redis_pool_elt::new_connection() -> redisAsyncContext * * We cannot reuse connection, so we just recursively call * this function one more time */ + msg_debug_rpool("cannot reuse the existing connection to %s:%d: %p; errno=%d", + ip.c_str(), port, conn->ctx, err); return new_connection(); } else { @@ -481,6 +483,9 @@ auto redis_pool_elt::new_connection() -> redisAsyncContext * } else { auto *nctx = redis_async_new(); + msg_debug_rpool("error in the inactive connection: %s; opened new connection to %s:%d: %p", + conn->ctx->errstr, ip.c_str(), port, nctx); + if (nctx) { active.emplace_front(std::make_unique<redis_pool_connection>(pool, this, db.c_str(), username.c_str(), password.c_str(), nctx)); @@ -492,10 +497,14 @@ auto redis_pool_elt::new_connection() -> redisAsyncContext * } else { auto *nctx = redis_async_new(); + if (nctx) { active.emplace_front(std::make_unique<redis_pool_connection>(pool, this, db.c_str(), username.c_str(), password.c_str(), nctx)); active.front()->elt_pos = active.begin(); + auto conn = active.front().get(); + msg_debug_rpool("no inactive connections; opened new connection to %s:%d: %p", + ip.c_str(), port, nctx); } return nctx; |