end
local limit_parser
-local function parse_string_limit(lim)
+local function parse_string_limit(lim, no_error)
local function parse_time_suffix(s)
if s == 's' then
return 1
return t[2], t[1]
end
- rspamd_logger.errx(rspamd_config, 'bad limit: %s', lim)
+ if not no_error then
+ rspamd_logger.errx(rspamd_config, 'bad limit: %s', lim)
+ end
return nil
end
local res = custom_keywords[settings[k]]['get_limit'](task)
if type(res) == 'string' then res = {res} end
for _, r in ipairs(res) do
- local plim, size = parse_string_limit(r)
+ local plim, size = parse_string_limit(r, true)
if plim then
table.insert(args, {{plim, size}, rk})
else
local res = custom_keywords[settings[k]]['get_limit'](task)
if type(res) == 'string' then res = {res} end
for _, r in ipairs(res) do
- local plim, size = parse_string_limit(r)
+ local plim, size = parse_string_limit(r, true)
if plim then
table.insert(args, {{plim, size}, rate_key})
else
- local rkey = string.match(settings[k], 'redis:(.*)')
+ local rkey = string.match(r, 'redis:(.*)')
if rkey then
table.insert(redis_keys, rkey)
redis_keys_rev[#redis_keys] = rate_key