]> source.dussan.org Git - rspamd.git/commitdiff
Do not treat autolearn errors as fatal
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 6 Jan 2016 22:27:44 +0000 (22:27 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 6 Jan 2016 22:27:44 +0000 (22:27 +0000)
src/libserver/task.c
src/libserver/task.h
src/libstat/stat_process.c

index bee7df22dd065f8c384c302ba174ae718f529f18..fe7d490c204cc82682f97c5c51be15c093e772c4 100644 (file)
@@ -466,8 +466,11 @@ rspamd_task_process (struct rspamd_task *task, guint stages)
                                        task->flags & RSPAMD_TASK_FLAG_LEARN_SPAM,
                                        task->cfg->lua_state, task->classifier,
                                        st, &stat_error)) {
+
+                               if (!(task->flags & RSPAMD_TASK_FLAG_LEARN_AUTO)) {
+                                       task->err = stat_error;
+                               }
                                msg_err_task ("learn error: %e", stat_error);
-                               task->err = stat_error;
                                task->processed_stages |= RSPAMD_TASK_STAGE_DONE;
                        }
                }
index 7ede95b317f5d3bd85021acf09158a4fcbbb25e1..d64d6461c04cf4793f49fd4d787e07dd9b69af58 100644 (file)
@@ -115,6 +115,7 @@ enum rspamd_task_stage {
 #define RSPAMD_TASK_FLAG_ALREADY_LEARNED (1 << 15)
 #define RSPAMD_TASK_FLAG_LEARN_SPAM (1 << 16)
 #define RSPAMD_TASK_FLAG_LEARN_HAM (1 << 17)
+#define RSPAMD_TASK_FLAG_LEARN_AUTO (1 << 18)
 
 #define RSPAMD_TASK_IS_SKIPPED(task) (((task)->flags & RSPAMD_TASK_FLAG_SKIP))
 #define RSPAMD_TASK_IS_JSON(task) (((task)->flags & RSPAMD_TASK_FLAG_JSON))
index 6635f8aa748d8ab4d6594f0aa3da7946b3fb2c56..4045951eb9f7f93bfe5cd1c93f6091342034507f 100644 (file)
@@ -707,6 +707,10 @@ rspamd_stat_check_autolearn (struct rspamd_task *task)
                }
        }
 
+       if (ret) {
+               task->flags |= RSPAMD_TASK_FLAG_LEARN_AUTO;
+       }
+
        return ret;
 }