mirror of
https://github.com/multica-ai/multica.git
synced 2026-08-02 01:45:52 +02:00
The sliding-window Lua script used the nanosecond timestamp as both the ZSET score and member. Two requests landing in the same nanosecond collided on an identical member, so ZADD updated in place instead of inserting and the window under-counted — letting requests through past the limit. This surfaced as a flaky CI failure in TestRedisWebhookIPRateLimiter_HasSeparateBudgetFromTokenLimiter. Keep the timestamp as the score (so ZREMRANGEBYSCORE trimming is unchanged) and use a per-request UUID as the member so each admitted request is counted exactly once. Co-authored-by: J <j@multica.ai> Co-authored-by: multica-agent <github@multica.ai>
6.6 KiB
6.6 KiB