From 28302c84ef7c9ecdb4845b445d5ebba4c1ef204f Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 16 Oct 2024 11:27:11 +0100 Subject: [PATCH] [Fix] Restore propagation of spam/ham learns --- src/libstat/stat_internal.h | 10 +++++----- src/libstat/stat_process.c | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/libstat/stat_internal.h b/src/libstat/stat_internal.h index 96d67cbf6..663c39df5 100644 --- a/src/libstat/stat_internal.h +++ b/src/libstat/stat_internal.h @@ -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; diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 5db3af6ce..17caf4cc6 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -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"); -- 2.39.5