diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-04-20 15:39:11 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-04-20 15:39:11 +0100 |
commit | d4a35f5b65dea20d990b8a82835396bbca5cfb52 (patch) | |
tree | a9c5e3a25cfddbdad66c816b8961600087c4cdaf /lualib | |
parent | efc103598b304ad1292cdf590e36255b8b16c342 (diff) | |
download | rspamd-d4a35f5b65dea20d990b8a82835396bbca5cfb52.tar.gz rspamd-d4a35f5b65dea20d990b8a82835396bbca5cfb52.zip |
[Feature] Try harder to upload scripts to the Redis server
Issue: #2186
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_redis.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lualib/lua_redis.lua b/lualib/lua_redis.lua index bb229479c..d22a4010c 100644 --- a/lualib/lua_redis.lua +++ b/lualib/lua_redis.lua @@ -812,6 +812,7 @@ local function load_script_taskless(script, cfg, ev_base) "uploaded redis script to %s with id %s, sha: %s", opt.upstream:get_addr(), script.id, data) script.sha = data -- We assume that sha is the same on all servers + script.fatal_error = nil end script.in_flight = script.in_flight - 1 @@ -851,7 +852,16 @@ local function add_redis_script(script, redis_params) -- Register on load function rspamd_config:add_on_load(function(cfg, ev_base, worker) - load_redis_script(new_script, cfg, ev_base, worker) + local mult = 0.0 + rspamd_config:add_periodic(ev_base, 0.0, function() + if not new_script.sha then + load_redis_script(new_script, cfg, ev_base, worker) + mult = mult + 1 + return 1.0 * mult -- Check one more time in one second + end + + return false + end, false) end) table.insert(redis_scripts, new_script) |