From d4c9304de9add00b4c1852b81fb1dfbdda694ca7 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 8 Jan 2016 15:17:02 +0000 Subject: [PATCH] Reorder learn procedure. --- src/libstat/stat_process.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index fe64eb65b..9d4c3c7f9 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -536,6 +536,14 @@ rspamd_stat_backends_learn (struct rspamd_stat_ctx *st_ctx, res = FALSE; } + else { + if (!!spam == !!st->stcf->is_spam) { + st->backend->inc_learns (task, bk_run, st_ctx); + } + else { + st->backend->dec_learns (task, bk_run, st_ctx); + } + } } } @@ -576,23 +584,6 @@ rspamd_stat_backends_post_learn (struct rspamd_stat_ctx *st_ctx, continue; } - if (!task->flags & RSPAMD_TASK_FLAG_UNLEARN) { - if (!!spam != !!st->stcf->is_spam) { - /* If we are not unlearning, then do not touch another class */ - continue; - } - - st->backend->inc_learns (task, bk_run, st_ctx); - } - else { - if (!!spam == !!st->stcf->is_spam) { - st->backend->inc_learns (task, bk_run, st_ctx); - } - else { - st->backend->dec_learns (task, bk_run, st_ctx); - } - } - st->backend->finalize_learn (task, bk_run, st_ctx); } } -- 2.39.5