]> source.dussan.org Git - rspamd.git/commitdiff
Reorder learn procedure.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 8 Jan 2016 15:17:02 +0000 (15:17 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 8 Jan 2016 15:17:02 +0000 (15:17 +0000)
src/libstat/stat_process.c

index fe64eb65bdf2ee34e0372ff4bf95367314f3f211..9d4c3c7f9b02ace7709336a40cd2591467503a4b 100644 (file)
@@ -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);
                }
        }