diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-09-08 19:09:14 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-09-08 19:09:14 +0100 |
commit | 9225d2eb95f2860e51bbb627796943a3076878d1 (patch) | |
tree | 8683fe80e83fafc78cf0eee354450557d18e2026 | |
parent | 91a05a2caa1f35b78d704ed93f52c0c2f6c491cd (diff) | |
download | rspamd-9225d2eb95f2860e51bbb627796943a3076878d1.tar.gz rspamd-9225d2eb95f2860e51bbb627796943a3076878d1.zip |
Fix creating languages on learning.
-rw-r--r-- | src/libstat/backends/sqlite3_backend.c | 15 | ||||
-rw-r--r-- | src/libstat/stat_process.c | 11 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c index 50c9886df..a9299e31e 100644 --- a/src/libstat/backends/sqlite3_backend.c +++ b/src/libstat/backends/sqlite3_backend.c @@ -509,6 +509,16 @@ rspamd_sqlite3_init (struct rspamd_stat_ctx *ctx, bk->enable_languages = FALSE; } + if (bk->enable_languages) { + msg_info_config ("enable per language statistics for %s", + stf->symbol); + } + + if (bk->enable_users) { + msg_info_config ("enable per users statistics for %s", + stf->symbol); + } + ctx->statfiles ++; curst = curst->next; @@ -656,6 +666,9 @@ rspamd_sqlite3_finalize_process (struct rspamd_task *task, gpointer runtime, bk->in_transaction = FALSE; } + rt->lang_id = -1; + rt->user_id = -1; + return; } @@ -692,7 +705,7 @@ rspamd_sqlite3_learn_token (struct rspamd_task *task, struct token_node_s *tok, } if (rt->lang_id == -1) { - rt->lang_id = rspamd_sqlite3_get_language (bk, task, FALSE); + rt->lang_id = rspamd_sqlite3_get_language (bk, task, TRUE); } iv = res->value; diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 32367f9c4..d1e23baf2 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -708,6 +708,17 @@ rspamd_stat_learn (struct rspamd_task *task, gboolean spam, lua_State *L, while (cur) { cl_run = (struct rspamd_classifier_runtime *)cur->data; + curst = cl_run->st_runtime; + + /* Needed to finalize pre-process stage */ + while (curst) { + st_run = curst->data; + cl_run->backend->finalize_process (task, + st_run->backend_runtime, + cl_run->backend->ctx); + curst = g_list_next (curst); + } + if (cl_run->cl && !cl_run->skipped) { cl_ctx = cl_run->cl->init_func (task->task_pool, cl_run->clcf); |