aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/stat_process.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-10-14 14:07:30 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-10-14 14:07:30 +0100
commit203de2ba032b85924dd01076f72d21752a7a4f29 (patch)
treee5f33827f36c60feb3d168999c76700960497574 /src/libstat/stat_process.c
parentc7cf4d68dbf5adb173f5a7391833cc9df8e2b4dd (diff)
downloadrspamd-203de2ba032b85924dd01076f72d21752a7a4f29.tar.gz
rspamd-203de2ba032b85924dd01076f72d21752a7a4f29.zip
[Fix] Fix autolearning errors and redis cache
Diffstat (limited to 'src/libstat/stat_process.c')
-rw-r--r--src/libstat/stat_process.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c
index ed24499ba..993de3816 100644
--- a/src/libstat/stat_process.c
+++ b/src/libstat/stat_process.c
@@ -547,6 +547,16 @@ rspamd_stat_classifiers_learn (struct rspamd_stat_ctx *st_ctx,
gint cb_ref;
gchar *cond_str = NULL;
+ if ((task->flags & RSPAMD_TASK_FLAG_ALREADY_LEARNED) && err != NULL &&
+ *err == NULL) {
+ /* Do not learn twice */
+ g_set_error (err, rspamd_stat_quark (), 404, "<%s> has been already "
+ "learned as %s, ignore it", task->message_id,
+ spam ? "spam" : "ham");
+
+ return FALSE;
+ }
+
/* Check whether we have learned that file */
for (i = 0; i < st_ctx->classifiers->len; i ++) {
cl = g_ptr_array_index (st_ctx->classifiers, i);