From 923f93fb6bad21c3a6edadca15e516daa05d1e5f Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 21 Oct 2021 15:17:12 +0100 Subject: [PATCH] [Minor] Fix several issues found --- src/libstat/backends/cdb_backend.cxx | 3 +++ src/libstat/stat_config.c | 4 ++-- src/libstat/stat_process.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libstat/backends/cdb_backend.cxx b/src/libstat/backends/cdb_backend.cxx index eb86c6964..5e1ec243b 100644 --- a/src/libstat/backends/cdb_backend.cxx +++ b/src/libstat/backends/cdb_backend.cxx @@ -111,6 +111,9 @@ public: { std::swap(st, other.st); std::swap(db, other.db); + std::swap(loaded, other.loaded); + std::swap(learns_spam, other.learns_spam); + std::swap(learns_ham, other.learns_ham); return *this; } diff --git a/src/libstat/stat_config.c b/src/libstat/stat_config.c index 5f48cf1f9..d6fdc9673 100644 --- a/src/libstat/stat_config.c +++ b/src/libstat/stat_config.c @@ -330,10 +330,10 @@ rspamd_stat_init (struct rspamd_config *cfg, struct ev_loop *ev_base) st->classifier = cl; st->stcf = stf; - if (!(cl->cfg->flags & RSPAMD_FLAG_CLASSIFIER_NO_BACKEND) && bk) { + if (!(cl->cfg->flags & RSPAMD_FLAG_CLASSIFIER_NO_BACKEND)) { st->backend = bk; st->bkcf = bk->init (stat_ctx, cfg, st); - msg_debug_config ("added backend %s for symbol %s", + msg_info_config ("added backend %s for symbol %s", bk->name, stf->symbol); } else { diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 35c9d1215..338dc3034 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -314,7 +314,7 @@ rspamd_stat_preprocess (struct rspamd_stat_ctx *st_ctx, continue; } - if (st->backend->read_only) { + if (is_learn && st->backend->read_only) { /* Read only backend, skip it */ g_ptr_array_index (task->stat_runtimes, i) = NULL; continue; -- 2.39.5