aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-02-03 19:12:42 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-02-03 19:12:42 +0000
commit9d275f06c4089244c8de3a932724b983b4f4adc3 (patch)
treec19c8809734624a0472da2a8f27dff79d3fdee8c
parent8f35dd59707be990cc078f1831762f020c8a373a (diff)
downloadrspamd-9d275f06c4089244c8de3a932724b983b4f4adc3.tar.gz
rspamd-9d275f06c4089244c8de3a932724b983b4f4adc3.zip
[Fix] Set symcache item in coroutine calls
-rw-r--r--src/lua/lua_config.c2
-rw-r--r--src/lua/lua_redis.c5
2 files changed, 6 insertions, 1 deletions
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);
}