From 203de2ba032b85924dd01076f72d21752a7a4f29 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 14 Oct 2016 14:07:30 +0100 Subject: [Fix] Fix autolearning errors and redis cache --- src/libstat/stat_process.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/libstat/stat_process.c') 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); -- cgit v1.2.3