]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Restore propagation of spam/ham learns
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 16 Oct 2024 10:27:11 +0000 (11:27 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 16 Oct 2024 10:27:11 +0000 (11:27 +0100)
src/libstat/stat_internal.h
src/libstat/stat_process.c

index 96d67cbf67f43e769d074bfb950ac3027c84b01d..663c39df546786114eed7c61d10d5abd0eeb9679 100644 (file)
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2016 Vsevolod Stakhov
+/*
+ * Copyright 2024 Vsevolod Stakhov
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *   http://www.apache.org/licenses/LICENSE-2.0
+ *    http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -41,8 +41,8 @@ struct rspamd_classifier {
        GArray *statfiles_ids; /* int */
        struct rspamd_stat_cache *cache;
        gpointer cachecf;
-       gulong spam_learns;
-       gulong ham_learns;
+       guint64 spam_learns;
+       guint64 ham_learns;
        int autolearn_cbref;
        struct rspamd_classifier_config *cfg;
        struct rspamd_stat_classifier *subrs;
index 5db3af6ce785ce49ce83fbeb204106689275a8a9..17caf4cc61f049c541e646804d051a2a1b6621a4 100644 (file)
@@ -1017,6 +1017,9 @@ rspamd_stat_check_autolearn(struct rspamd_task *task)
                cl = g_ptr_array_index(st_ctx->classifiers, i);
                ret = FALSE;
 
+               rspamd_mempool_set_variable(task->task_pool, RSPAMD_MEMPOOL_HAM_LEARNS, (void *) &cl->ham_learns, NULL);
+               rspamd_mempool_set_variable(task->task_pool, RSPAMD_MEMPOOL_SPAM_LEARNS, (void *) &cl->spam_learns, NULL);
+
                if (cl->cfg->opts) {
                        obj = ucl_object_lookup(cl->cfg->opts, "autolearn");