diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-11-11 18:54:51 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-11 18:54:51 +0600 |
commit | afb9ccc0d5e59a293831ee70bc3f10f7a2ffbafb (patch) | |
tree | 5628dc17b0db75b319d7a49d85bf9a66354e7860 /src/plugins/lua | |
parent | 95151295e8358136add594e2c5b048e79b19a130 (diff) | |
parent | 6140c9eabf1d5cb58da7f925f35bdd89749dca8a (diff) | |
download | rspamd-afb9ccc0d5e59a293831ee70bc3f10f7a2ffbafb.tar.gz rspamd-afb9ccc0d5e59a293831ee70bc3f10f7a2ffbafb.zip |
Merge pull request #5162 from left-try/master
Store LRU cache of last filled ratelimit buckets
Diffstat (limited to 'src/plugins/lua')
-rw-r--r-- | src/plugins/lua/ratelimit.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua index 168d8d63a..c20e61b17 100644 --- a/src/plugins/lua/ratelimit.lua +++ b/src/plugins/lua/ratelimit.lua @@ -41,6 +41,8 @@ local settings = { -- Do not check ratelimits for these recipients whitelisted_rcpts = { 'postmaster', 'mailer-daemon' }, prefix = 'RL', + lfb_cache_prefix = 'RL_cache_prefix', -- Last filled buckets cache prefix + lfb_max_cache_size = 30, -- If enabled, we apply dynamic rate limiting based on the verdict dynamic_rate_limit = false, ham_factor_rate = 1.01, @@ -455,7 +457,8 @@ local function ratelimit_cb(task) { key = value.hash, task = task, is_write = true }, gen_check_cb(pr, bucket, value.name, value.hash), { value.hash, tostring(now), tostring(rate), tostring(bucket.burst), - tostring(settings.expire), tostring(bincr), tostring(dyn_rate_enabled) }) + tostring(settings.expire), tostring(bincr), tostring(dyn_rate_enabled), + tostring(settings.lfb_cache_prefix), tostring(settings.lfb_max_cache_size) }) end end end |