From 66cc2d3d88dc48fbbffc59e64549b0ee1da4bcf4 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 22 Jan 2024 14:18:34 +0000 Subject: [Fix] Fix storing of the bayes tokens --- src/libstat/backends/redis_backend.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/libstat') 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); -- cgit v1.2.3