From 4dfcb9de863b6714694768a4269dcbe555d811ef Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 10 Dec 2022 19:37:02 +0000 Subject: [PATCH] [Minor] Fix `is_write` usage for freshly loaded scripts --- lualib/lua_redis.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lualib/lua_redis.lua b/lualib/lua_redis.lua index d8f87c7bd..acbb46969 100644 --- a/lualib/lua_redis.lua +++ b/lualib/lua_redis.lua @@ -1145,12 +1145,13 @@ local function prepare_redis_call(script) return options end -local function load_script_task(script, task) +local function load_script_task(script, task, is_write) local rspamd_redis = require "rspamd_redis" local opts = prepare_redis_call(script) for _,opt in ipairs(opts) do opt.task = task + opt.is_write = is_write opt.callback = function(err, data) if err then logger.errx(task, 'cannot upload script to %s: %s; registered from: %s:%s', @@ -1188,13 +1189,14 @@ local function load_script_task(script, task) end end -local function load_script_taskless(script, cfg, ev_base) +local function load_script_taskless(script, cfg, ev_base, is_write) local rspamd_redis = require "rspamd_redis" local opts = prepare_redis_call(script) for _,opt in ipairs(opts) do opt.config = cfg opt.ev_base = ev_base + opt.is_write = is_write opt.callback = function(err, data) if err then logger.errx(cfg, 'cannot upload script to %s: %s; registered from: %s:%s', @@ -1358,7 +1360,7 @@ local function exec_redis_script(id, params, callback, keys, args) callback('NOSCRIPT', nil) end end) - load_script_task(script, params.task) + load_script_task(script, params.task, params.is_write) end end -- 2.39.5