commit 9d275f0: [Fix] Set symcache item in coroutine calls

Vsevolod Stakhov vsevolod at rspamd.com
Fri Feb 3 19:14:03 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-02-03 19:12:42 +0000
URL: https://github.com/rspamd/rspamd/commit/9d275f06c4089244c8de3a932724b983b4f4adc3 (HEAD -> master)

[Fix] Set symcache item in coroutine calls

---
 src/lua/lua_config.c | 2 +-
 src/lua/lua_redis.c  | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index c732b67a1..c58b35c56 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -1362,6 +1362,7 @@ lua_metric_symbol_callback_coro (struct rspamd_task *task,
 	struct rspamd_task **ptask;
 	struct thread_entry *thread_entry;
 
+	cd->item = item;
 	rspamd_symcache_item_async_inc (task, item, "lua coro symbol");
 	thread_entry = lua_thread_pool_get_for_task (task);
 
@@ -1370,7 +1371,6 @@ lua_metric_symbol_callback_coro (struct rspamd_task *task,
 
 	lua_State *thread = thread_entry->lua_state;
 	cd->stack_level = lua_gettop (thread);
-	cd->item = item;
 
 	if (cd->cb_is_ref) {
 		lua_rawgeti (thread, LUA_REGISTRYINDEX, cd->callback.ref);
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c
index 3d5ac3db9..8b72a52da 100644
--- a/src/lua/lua_redis.c
+++ b/src/lua/lua_redis.c
@@ -679,6 +679,11 @@ lua_redis_callback_sync (redisAsyncContext *ac, gpointer r, gpointer priv)
 				ctx->thread = NULL;
 
 				results = lua_redis_push_results(ctx, thread->lua_state);
+
+				if (ud->item) {
+					rspamd_symcache_set_cur_item (ud->task, ud->item);
+				}
+
 				lua_thread_resume (thread, results);
 				lua_redis_cleanup_events(ctx);
 			}


More information about the Commits mailing list