diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-08 15:17:02 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-08 15:17:02 +0000 |
commit | d4c9304de9add00b4c1852b81fb1dfbdda694ca7 (patch) | |
tree | 9a850432046cf2998af643d06691e4594c88e7cc | |
parent | 3209a937dba3ee45e9317c502056d9035a06f951 (diff) | |
download | rspamd-d4c9304de9add00b4c1852b81fb1dfbdda694ca7.tar.gz rspamd-d4c9304de9add00b4c1852b81fb1dfbdda694ca7.zip |
Reorder learn procedure.
-rw-r--r-- | src/libstat/stat_process.c | 25 |
1 files 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); } } |