aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-11-25 11:04:53 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-11-25 11:04:53 +0000
commit4d78f29a7b822231bce8d557f18b644ed5deaf73 (patch)
treea70b12f0f502da94f4bb9848e14c00ca9067ddca /lualib/rspamadm
parent4d9be4459247864c90c36346d141678e51bd3f3c (diff)
downloadrspamd-4d78f29a7b822231bce8d557f18b644ed5deaf73.tar.gz
rspamd-4d78f29a7b822231bce8d557f18b644ed5deaf73.zip
[Minor] Some display/adding fixes
Diffstat (limited to 'lualib/rspamadm')
-rw-r--r--lualib/rspamadm/fuzzy_stat.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/lualib/rspamadm/fuzzy_stat.lua b/lualib/rspamadm/fuzzy_stat.lua
index 011f9d37c..c65a1a477 100644
--- a/lualib/rspamadm/fuzzy_stat.lua
+++ b/lualib/rspamadm/fuzzy_stat.lua
@@ -72,10 +72,16 @@ local function add_data(target, src)
end
elseif k == 'ratelimit' then
if not target.ratelimit then
- target.ratelimit = {}
+ target.ratelimit = {
+ cur = {
+ last = 0,
+ count = 0
+ }
+ }
end
-- Ratelimit is passed as {cur = count, last = time}
- target.ratelimit.cur = v
+ target.ratelimit.cur.count = v.cur + target.ratelimit.cur.count
+ target.ratelimit.cur.last = math.max(v.last, target.ratelimit.cur.last)
end
end
end
@@ -355,7 +361,7 @@ return function(args, res)
print(string.format('\tLimit: %s (%.2f per hour leak rate)',
print_num(key_stat.ratelimit.limit.burst), (key_stat.ratelimit.limit.rate or 0.0) * 3600))
print(string.format('\tCurrent: %s (%s last)',
- print_num(key_stat.ratelimit.cur), os.date('%c', key_stat.ratelimit.last)))
+ print_num(key_stat.ratelimit.cur.count), os.date('%c', key_stat.ratelimit.cur.last)))
print('')
end