aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/backends
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-01-22 14:18:34 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-01-22 14:42:05 +0000
commit66cc2d3d88dc48fbbffc59e64549b0ee1da4bcf4 (patch)
treeae2cbc182ea116a1150eada9db7c89f3fe582e3a /src/libstat/backends
parente7b3d77bc47de5e235f320873ac500b4ea8ea71e (diff)
downloadrspamd-66cc2d3d88dc48fbbffc59e64549b0ee1da4bcf4.tar.gz
rspamd-66cc2d3d88dc48fbbffc59e64549b0ee1da4bcf4.zip
[Fix] Fix storing of the bayes tokens
Diffstat (limited to 'src/libstat/backends')
-rw-r--r--src/libstat/backends/redis_backend.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstat/backends/redis_backend.cxx b/src/libstat/backends/redis_backend.cxx
index 375fa6c9b..4d9429360 100644
--- a/src/libstat/backends/redis_backend.cxx
+++ b/src/libstat/backends/redis_backend.cxx
@@ -1017,11 +1017,6 @@ rspamd_redis_learn_tokens(struct rspamd_task *task,
}
lua_new_text(L, tokens_buf, tokens_len, false);
- if (text_tokens_len) {
- nargs = 9;
- lua_new_text(L, text_tokens_buf, text_tokens_len, false);
- }
-
/* Store rt in random cookie */
char *cookie = (char *) rspamd_mempool_alloc(task->task_pool, 16);
rspamd_random_hex(cookie, 16);
@@ -1031,6 +1026,11 @@ rspamd_redis_learn_tokens(struct rspamd_task *task,
lua_pushstring(L, cookie);
lua_pushcclosure(L, &rspamd_redis_learned, 1);
+ if (text_tokens_len) {
+ nargs = 9;
+ lua_new_text(L, text_tokens_buf, text_tokens_len, false);
+ }
+
if (lua_pcall(L, nargs, 0, err_idx) != 0) {
msg_err_task("call to script failed: %s", lua_tostring(L, -1));
lua_settop(L, err_idx - 1);