From c2fd943dc8454742cd8be85c05e20adaf4719a2d Mon Sep 17 00:00:00 2001
From: Vsevolod Stakhov <vsevolod@rspamd.com>
Date: Wed, 17 Jan 2024 14:48:24 +0000
Subject: [Project] Final things on redis cache rework

---
 src/libstat/learn_cache/redis_cache.cxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/libstat')

diff --git a/src/libstat/learn_cache/redis_cache.cxx b/src/libstat/learn_cache/redis_cache.cxx
index 86a6a35d4..b67df70a2 100644
--- a/src/libstat/learn_cache/redis_cache.cxx
+++ b/src/libstat/learn_cache/redis_cache.cxx
@@ -223,7 +223,7 @@ rspamd_stat_cache_checked(lua_State *L)
 		auto val = lua_tointeger(L, 3);
 
 		if ((val > 0 && (task->flags & RSPAMD_TASK_FLAG_LEARN_SPAM)) ||
-			(val < 0 && (task->flags & RSPAMD_TASK_FLAG_LEARN_HAM))) {
+			(val <= 0 && (task->flags & RSPAMD_TASK_FLAG_LEARN_HAM))) {
 			/* Already learned */
 			msg_info_task("<%s> has been already "
 						  "learned as %s, ignore it",
@@ -293,7 +293,7 @@ gint rspamd_stat_cache_redis_learn(struct rspamd_task *task,
 	gint err_idx = lua_gettop(L);
 
 	/* Function arguments */
-	lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->check_ref);
+	lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->learn_ref);
 	rspamd_lua_task_push(L, task);
 	lua_pushstring(L, h);
 	lua_pushboolean(L, is_spam);
-- 
cgit v1.2.3