]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Try to avoid recursive events deletions
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 17 Jun 2016 12:18:01 +0000 (13:18 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 17 Jun 2016 12:18:01 +0000 (13:18 +0100)
src/libstat/backends/redis_backend.c

index c0d54325e8287928946f6b52ece8e285d8efc7f0..e83fc3e46187f1d4d40fd9eff94a0f917407b755 100644 (file)
@@ -853,10 +853,15 @@ rspamd_redis_processed (redisAsyncContext *c, gpointer r, gpointer priv)
        else {
                msg_err_task ("error getting reply from redis server %s: %s",
                                rspamd_upstream_name (rt->selected), c->errstr);
-               rspamd_upstream_fail (rt->selected);
+
+               if (rt->redis) {
+                       rspamd_upstream_fail (rt->selected);
+               }
        }
 
-       rspamd_session_remove_event (task->s, rspamd_redis_fin, rt);
+       if (rt->redis) {
+               rspamd_session_remove_event (task->s, rspamd_redis_fin, rt);
+       }
 }
 
 /* Called when we have set tokens during learning */
@@ -870,12 +875,17 @@ rspamd_redis_learned (redisAsyncContext *c, gpointer r, gpointer priv)
 
        if (c->err == 0) {
                rspamd_upstream_ok (rt->selected);
-               rspamd_session_remove_event (task->s, rspamd_redis_fin_learn, rt);
        }
        else {
                msg_err_task_check ("error getting reply from redis server %s: %s",
                                rspamd_upstream_name (rt->selected), c->errstr);
-               rspamd_upstream_fail (rt->selected);
+
+               if (rt->redis) {
+                       rspamd_upstream_fail (rt->selected);
+               }
+       }
+
+       if (rt->redis) {
                rspamd_session_remove_event (task->s, rspamd_redis_fin_learn, rt);
        }
 }