Conversation
- Moved GET /api/metrics route before readLimiter middleware - Added /api/metrics to the exempt paths set (EXEMPT_PATHS) - Rewrote rateLimit.test.ts with 6 tests covering bypass and throttling - Fixed pre-existing empty try block in /api/open-issues route Closes ritik4ever#904
|
@dami080 is attempting to deploy a commit to the ritik4ever's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@dami080 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Hi @dami080, This PR could not be merged because it has merge conflicts with the target branch. Please resolve the merge conflicts, push the updated changes, and the PR can be reviewed and merged. Thank you! |
1 similar comment
|
Hi @dami080, This PR could not be merged because it has merge conflicts with the target branch. Please resolve the merge conflicts, push the updated changes, and the PR can be reviewed and merged. Thank you! |
Overview
This PR adds comprehensive tests verifying that health endpoints (
/api/health,/api/health/deep,/worker/health) and the metrics endpoint (/api/metrics) remain exempt from rate limiting under high load, while confirming regular endpoints are correctly throttled. It also moves the/api/metricsroute before thereadLimitermiddleware and adds it to the exempt paths to close a gap where metrics were unintentionally rate-limited.Related Issue
Closes #904
Changes
Rate-limit exemption for
/api/metricsbackend/src/utils.ts� RenamedHEALTH_PATHStoEXEMPT_PATHSand added/api/metricsto the set so thereadLimiterskip function covers itbackend/src/app.ts� MovedGET /api/metricsroute definition beforeapp.use(readLimiter)(matching the pattern used by health endpoints) so it is never subject to the global GET rate limiterRate-limit bypass tests
backend/test/rateLimit.test.ts� Replaced the single passthrough test with 6 focused tests:/api/health,/api/health/deep,/worker/health, and/api/metricsall return 200 under 130 concurrent requests (exceeding the 120 req/min read limit)Incidental fixes
backend/src/app.ts� The/api/open-issuesroute had an emptytry {}with nocatchblock (syntax error). Added the proper implementation usinglistOpenIssues()Verification Results
/api/metricsreturns 200 at 130 reqRetry-Afterheader