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);
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 {
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;