This commit is contained in:
Giovanni Rezcjikov
2026-03-09 18:09:02 +03:00
parent be36c6f0c4
commit f188150c9f
25 changed files with 694 additions and 53 deletions
@@ -57,10 +57,7 @@ func (r *RateLimiter) Allow(ctx context.Context, key string, cfg RateLimitConfig
}
count := int(incrCmd.Val())
remaining := cfg.Max - count
if remaining < 0 {
remaining = 0
}
remaining := max(cfg.Max-count, 0)
if count > cfg.Max {
if cfg.BlockFor > 0 {