Commit Graph
2 Commits
Author SHA1 Message Date
Geekertao d9d2bbb850 fix: sample limiter timestamp under lock and use per-request config snapshot
- rateLimiter.allow now samples time.Now() while holding the mutex, so entries[ip] stays time-ascending under concurrency; allowAt/allowLocked share the same locked logic for deterministic tests.
- handler passes its single config snapshot into proxy and render404 so one request never mixes config versions.
- rewrite sweep test to hit sweepLocked directly; restore config/log/gin global state in tests; add real-clock concurrency ordering test.
2026-10-10 23:04:41 +08:00
Geekertao 1344d42d7d perf: optimize request limiting
Replace per-request full-map scan under a global mutex with a per-IP sliding window and throttled reclamation; publish config as an immutable atomic snapshot to remove reload/read races.
2026-10-10 22:57:34 +08:00