fix(server): reclaim expired callback rate-limit windows - #77
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (2)
Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour. Summary by CodeRabbit
WalkthroughThe callback rate limiter now tracks the next cleanup time and removes expired callback windows at most once per minute before admission checks. Existing retry behavior remains unchanged. Regression tests mock time and verify that expired webhook windows are removed, active callback limits remain enforced, wait-action windows are preserved, and response statuses and Merge Risk: ⚪ Minimal · up to Callback rate-limit entries now expire during later admissions while active limits and retry behavior remain intact. The change is ready to merge. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches✨ Simplify code
Comment |
Expired callback rate-limit windows remained in memory after their endpoints stopped receiving requests. Callback admission now removes expired entries at most once per minute while preserving active windows and their counts. Cleanup is request-driven: idle instances retain entries until the next admission after cleanup is due.
Webhook and Integration routes already resolve endpoints before recording rate-limit state, so arbitrary nonexistent endpoint IDs do not populate the map. This fixes retention of historical valid endpoint keys.
The regression test failed before the fix and now verifies cross-endpoint cleanup, preserved 429/Retry-After behavior for active windows, and admission after expiry.
Validation:
bun run format,bun run check,bun run test(1,088 tests), andbun run buildpassed.Fixes #71.