From: Vsevolod Stakhov Date: Fri, 8 Jan 2016 15:17:02 +0000 (+0000) Subject: Reorder learn procedure. X-Git-Tag: 1.1.0~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4c9304de9add00b4c1852b81fb1dfbdda694ca7;p=thirdparty%2Frspamd.git Reorder learn procedure. --- diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index fe64eb65bd..9d4c3c7f9b 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); } }