🛑 The Problem
When syncing massive repositories, we will inevitably hit GitHub's API rate limit (5,000 requests per hour). When this happens, Octokit throws a 429 error. Currently, our Inngest worker crashes, marks the job as failed, and the user never gets their data.
💡 The Solution
We must catch the 429 Rate Limit error, extract the reset timestamp, and use Inngest's native step.sleepUntil() feature to suspend the worker cleanly until GitHub restores our quota.
🛠️ Implementation Details
- Wrap the Octokit fetch loop in a try/catch block.
- If the error status is
403 or 429 and includes the x-ratelimit-reset header, parse the Unix timestamp.
- Convert the timestamp to a JavaScript Date object.
- Call
await step.sleepUntil('wait-for-rate-limit', resetDate).
- Once the sleep finishes, Inngest will automatically wake the worker back up and resume the loop.
✅ Acceptance Criteria
Ready to tackle this? Comment .take below to get automatically assigned!
🛑 The Problem
When syncing massive repositories, we will inevitably hit GitHub's API rate limit (5,000 requests per hour). When this happens, Octokit throws a 429 error. Currently, our Inngest worker crashes, marks the job as failed, and the user never gets their data.
💡 The Solution
We must catch the 429 Rate Limit error, extract the reset timestamp, and use Inngest's native
step.sleepUntil()feature to suspend the worker cleanly until GitHub restores our quota.🛠️ Implementation Details
403or429and includes thex-ratelimit-resetheader, parse the Unix timestamp.await step.sleepUntil('wait-for-rate-limit', resetDate).✅ Acceptance Criteria
Ready to tackle this? Comment
.takebelow to get automatically assigned!