commit 4dfcb9d: [Minor] Fix `is_write` usage for freshly loaded scripts

Vsevolod Stakhov vsevolod at rspamd.com
Sat Dec 10 19:42:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-12-10 19:37:02 +0000
URL: https://github.com/rspamd/rspamd/commit/4dfcb9de863b6714694768a4269dcbe555d811ef (HEAD -> master)

[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
 


More information about the Commits mailing list