fix: rate limiter cleanup, supabase pool, retry logic, remove dead code#448
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe changes improve rate-limit memory cleanup, add retries and backoff to GitHub GraphQL requests, configure Supabase connection pooling, simplify environment detection, and remove unused shared utility exports and imports. ChangesRuntime resilience and utility cleanup
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant githubGraphQL
participant fetchWithTimeout
participant GitHubGraphQLAPI
participant sleep
githubGraphQL->>fetchWithTimeout: send GraphQL request
fetchWithTimeout->>GitHubGraphQLAPI: HTTP request
GitHubGraphQLAPI-->>fetchWithTimeout: response or timeout
githubGraphQL->>sleep: wait with exponential backoff
githubGraphQL->>fetchWithTimeout: retry request
Possibly related PRs
Suggested labels: Suggested reviewers: Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Welcome to OSSfolio, @DebasmitaBose0! 🎉Thank you for opening this pull request and contributing to the open-source community! 🚀 To ensure a smooth review process, please make sure you have:
We will review your PR as soon as possible. Happy coding! 💻✨ |
|
🎉 Your PR just got merged, @DebasmitaBose0 — thank you for contributing to OSSfolio! Your work is now part of the project. Here's what to do next:
We really appreciate you taking the time. See you in the next PR! 🚀 |
Closes #422
Summary
Fixes in-memory rate limiter memory leak, adds Supabase connection pooling, adds retry logic to GitHub API calls, and removes dead code.
Changes
src/app/api/v1/users/[username]/route.ts— periodic cleanup interval (60s) evicts stale rate-limit entries; lazy Map initializationsrc/lib/supabase.ts— added POOL_CONFIG withdb.poolsettings (min:0, max:5, timeouts)src/lib/github.ts— added exponential backoff retry (3 attempts, 1s-10s delay) for 429/5xx/timeoutsrc/lib/validators/api.ts— removed unusedvalidateEmail,sanitizeObject,COMMON_SCHEMASsrc/lib/env.ts— removed unusedvalidatePublicEnv,validateServerEnv,getEnvWarning,isDevsrc/lib/score.ts— removed unusedgetScoreDeltaPercentagesrc/lib/fetch-with-timeout.ts— removed unusedisTimeoutErrorSummary by CodeRabbit
Bug Fixes
Improvements
Refactor