summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libstat/backends/redis_backend.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c
index 8aed06994..823a5f71b 100644
--- a/src/libstat/backends/redis_backend.c
+++ b/src/libstat/backends/redis_backend.c
@@ -767,14 +767,13 @@ rspamd_redis_connected (redisAsyncContext *c, gpointer r, gpointer priv)
}
rt->learned = val;
-
- rt->conn_state = RSPAMD_REDIS_CONNECTED;
REF_RETAIN (rt);
-
msg_debug_task ("connected to redis server, tokens learned for %s: %uL",
rt->redis_object_expanded, rt->learned);
rspamd_upstream_ok (rt->selected);
+ /* This also set state to terminated state */
rspamd_session_remove_event (task->s, rspamd_redis_fin, rt);
+ rt->conn_state = RSPAMD_REDIS_CONNECTED;
}
else {
/* This could be caused by removing redis context forcefully */