]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Add some more logs
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 7 Jan 2025 12:17:41 +0000 (12:17 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 7 Jan 2025 12:17:41 +0000 (12:17 +0000)
src/libserver/redis_pool.cxx

index cea8d0c8634eff68eb1adf00f24df044c0ad72e8..586260a6f6d03de332972b55a0f7cc5226ce89b7 100644 (file)
@@ -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;