From: Vsevolod Stakhov Date: Fri, 17 Jun 2016 12:18:01 +0000 (+0100) Subject: [Fix] Try to avoid recursive events deletions X-Git-Tag: 1.3.0~307 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2463093c9d11f897cbc96120930b41be6cacfbf3;p=rspamd.git [Fix] Try to avoid recursive events deletions --- diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index c0d54325e..e83fc3e46 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -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); } }