summaryrefslogtreecommitdiffstats
path: root/lualib/lua_maps.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-27 19:24:26 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-27 19:24:26 +0100
commit740a249ac32ba14ffec5f80f976120e3dd31bb4d (patch)
tree84853090f4fd3ffbfd75b8ec476ed84a539a2448 /lualib/lua_maps.lua
parent79e3360f4d091ebbc53e944cf882029156469383 (diff)
downloadrspamd-740a249ac32ba14ffec5f80f976120e3dd31bb4d.tar.gz
rspamd-740a249ac32ba14ffec5f80f976120e3dd31bb4d.zip
[Minor] Fix caching logic
Diffstat (limited to 'lualib/lua_maps.lua')
-rw-r--r--lualib/lua_maps.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/lualib/lua_maps.lua b/lualib/lua_maps.lua
index 23e5cb942..c2f0e406c 100644
--- a/lualib/lua_maps.lua
+++ b/lualib/lua_maps.lua
@@ -140,8 +140,8 @@ local function rspamd_map_add_from_ucl(opt, mtype, description)
elseif type(opt) == 'table' then
local k = lua_util.table_digest(opt)
if maps_cache[k] then
- rspamd_logger.infox(rspamd_config, 'reuse url for %s(%s)',
- opt, mtype)
+ rspamd_logger.infox(rspamd_config, 'reuse url for complex map definition %s: %s',
+ k:sub(1,8), description)
return maps_cache[k]
end
@@ -155,6 +155,7 @@ local function rspamd_map_add_from_ucl(opt, mtype, description)
if map then
ret.__data = map
setmetatable(ret, ret_mt)
+ maps_cache[k] = ret
return ret
end
else
@@ -167,6 +168,7 @@ local function rspamd_map_add_from_ucl(opt, mtype, description)
if map then
ret.__data = map
setmetatable(ret, ret_mt)
+ maps_cache[k] = ret
return ret
end
end
@@ -181,6 +183,7 @@ local function rspamd_map_add_from_ucl(opt, mtype, description)
if map then
ret.__data = map
setmetatable(ret, ret_mt)
+ maps_cache[k] = ret
return ret
end
else
@@ -195,6 +198,7 @@ local function rspamd_map_add_from_ucl(opt, mtype, description)
if map then
ret.__data = map
setmetatable(ret, ret_mt)
+ maps_cache[k] = ret
return ret
end
end
@@ -209,6 +213,7 @@ local function rspamd_map_add_from_ucl(opt, mtype, description)
if map then
ret.__data = map
setmetatable(ret, ret_mt)
+ maps_cache[k] = ret
return ret
end
else
@@ -247,6 +252,7 @@ local function rspamd_map_add_from_ucl(opt, mtype, description)
return nil
end
+ maps_cache[k] = ret
return ret
else
-- Empty map, huh?
@@ -265,6 +271,7 @@ local function rspamd_map_add_from_ucl(opt, mtype, description)
if map then
ret.__data = map
setmetatable(ret, ret_mt)
+ maps_cache[k] = ret
return ret
end
end -- opt[1]