aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/stat_process.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-01-28 15:01:32 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-01-28 15:01:32 +0000
commit7fd5a65a11d756618ddc51a22f005efdc108ba45 (patch)
treefc36369f37085220796d151aec5df94452f826d3 /src/libstat/stat_process.c
parent7ab573abf4036d2b1327099ac7c6634a80e455d7 (diff)
downloadrspamd-7fd5a65a11d756618ddc51a22f005efdc108ba45.tar.gz
rspamd-7fd5a65a11d756618ddc51a22f005efdc108ba45.zip
Increase revision after learning.
Diffstat (limited to 'src/libstat/stat_process.c')
-rw-r--r--src/libstat/stat_process.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c
index cdf45a80a..b0e8ffdb9 100644
--- a/src/libstat/stat_process.c
+++ b/src/libstat/stat_process.c
@@ -446,11 +446,13 @@ rspamd_stat_learn (struct rspamd_task *task, gboolean spam, lua_State *L,
struct rspamd_stat_ctx *st_ctx;
struct rspamd_tokenizer_runtime *tklist = NULL, *tok;
struct rspamd_classifier_runtime *cl_run;
+ struct rspamd_statfile_runtime *st_run;
struct classifier_ctx *cl_ctx;
struct preprocess_cb_data cbdata;
GList *cl_runtimes;
- GList *cur;
+ GList *cur, *curst;
gboolean ret = FALSE;
+ gulong nrev;
st_ctx = rspamd_stat_get_ctx ();
g_assert (st_ctx != NULL);
@@ -509,6 +511,19 @@ rspamd_stat_learn (struct rspamd_task *task, gboolean spam, lua_State *L,
g_tree_foreach (cl_run->tok->tokens, rspamd_stat_learn_token,
&cbdata);
+ curst = g_list_first (cl_run->st_runtime);
+
+ while (curst) {
+ st_run = (struct rspamd_statfile_runtime *)curst->data;
+
+ nrev = st_run->backend->inc_learns (st_run->backend_runtime,
+ st_run->backend->ctx);
+
+ msg_debug ("learned %s, new revision: %ul",
+ st_run->st->symbol, nrev);
+
+ curst = g_list_next (curst);
+ }
}
else {
return FALSE;