diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-12-06 17:33:27 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-12-06 17:33:27 +0000 |
commit | 02757e6d2af733367cb870fa2a24ceb505954f0e (patch) | |
tree | 09ba7ff80001418b9c346098642a161831fdbb5e /src | |
parent | cbc907994e73a2d0aa16900c587298fb307cca5b (diff) | |
download | rspamd-02757e6d2af733367cb870fa2a24ceb505954f0e.tar.gz rspamd-02757e6d2af733367cb870fa2a24ceb505954f0e.zip |
[Minor] Fix store/load
Diffstat (limited to 'src')
-rw-r--r-- | src/libstat/backends/redis_backend.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstat/backends/redis_backend.cxx b/src/libstat/backends/redis_backend.cxx index 46f88de19..1ff67bcb4 100644 --- a/src/libstat/backends/redis_backend.cxx +++ b/src/libstat/backends/redis_backend.cxx @@ -102,12 +102,14 @@ public: bool is_spam) -> std::optional<redis_stat_runtime<T> *> { auto var_name = fmt::format("{}_{}", redis_object_expanded, is_spam ? "S" : "H"); - auto *res = rspamd_mempool_steal_variable(task->task_pool, var_name.c_str()); + auto *res = rspamd_mempool_get_variable(task->task_pool, var_name.c_str()); if (res) { + msg_debug_bayes("recovered runtime from mempool at %s", var_name.c_str()); return reinterpret_cast<redis_stat_runtime<T> *>(res); } else { + msg_debug_bayes("no runtime at %s", var_name.c_str()); return std::nullopt; } } @@ -139,6 +141,7 @@ public: auto var_name = fmt::format("{}_{}", redis_object_expanded, is_spam ? "S" : "H"); /* We do not set destructor for the variable, as it should be already added on creation */ rspamd_mempool_set_variable(task->task_pool, var_name.c_str(), (gpointer) this, nullptr); + msg_debug_bayes("saved runtime in mempool at %s", var_name.c_str()); } }; |