diff options
-rw-r--r-- | src/libserver/redis_pool.c | 2 | ||||
-rw-r--r-- | src/lua/lua_redis.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/libserver/redis_pool.c b/src/libserver/redis_pool.c index e84f2360e..dd5adf221 100644 --- a/src/libserver/redis_pool.c +++ b/src/libserver/redis_pool.c @@ -334,7 +334,7 @@ rspamd_redis_pool_release_connection (struct rspamd_redis_pool *pool, if (conn != NULL) { g_assert (conn->active); - if (is_fatal || ctx->err == REDIS_ERR_IO || ctx->err == REDIS_ERR_EOF) { + if (is_fatal || ctx->err != REDIS_OK) { /* We need to terminate connection forcefully */ msg_debug_rpool ("closed connection forcefully"); REF_RELEASE (conn); diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c index 203def2d0..402190351 100644 --- a/src/lua/lua_redis.c +++ b/src/lua/lua_redis.c @@ -661,6 +661,8 @@ lua_redis_make_request (lua_State *L) if (ud->ctx) { msg_err_task_check ("cannot connect to redis: %s", ud->ctx->errstr); + rspamd_redis_pool_release_connection (task->cfg->redis_pool, + ud->ctx, TRUE); ud->ctx = NULL; } else { @@ -701,7 +703,7 @@ lua_redis_make_request (lua_State *L) else { msg_info_task_check ("call to redis failed: %s", ud->ctx->errstr); rspamd_redis_pool_release_connection (task->cfg->redis_pool, - ud->ctx, FALSE); + ud->ctx, TRUE); ud->ctx = NULL; REDIS_RELEASE (ctx); ret = FALSE; |