struct lua_redis_request_specific_userdata *sp_ud = arg;
struct lua_redis_userdata *ud;
struct lua_redis_ctx *ctx;
- redisAsyncContext *ac;
ctx = sp_ud->ctx;
ud = sp_ud->common_ud;
msg_debug_lua_redis("finished redis query %p from session %p; refcount=%d",
sp_ud, ctx, ctx->ref.refcount);
sp_ud->flags |= LUA_REDIS_SPECIFIC_FINISHED;
-
- if (!ud->terminated) {
- /* Release Redis connection to prevent callbacks after session cleanup */
- ud->terminated = 1;
- ac = ud->ctx;
- ud->ctx = NULL;
-
- if (ac) {
- rspamd_redis_pool_release_connection(ud->pool, ac,
- RSPAMD_REDIS_RELEASE_FATAL);
- }
- }
+ /* Prevent callbacks from accessing task data after session cleanup */
+ ud->terminated = 1;
REDIS_RELEASE(ctx);
}