Implement exponential backoff retry logic for Google API rate limits #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The application's Google Calendar event creation was vulnerable to rate limit failures from the Google Calendar API. When users hit rate limits (HTTP 429 or Google-specific rate limit errors like
rateLimitExceeded), the meeting creation would fail immediately without any retry mechanism, leading to a poor user experience.Solution
This PR implements a robust exponential backoff retry utility that gracefully handles Google API rate limits:
🆕 New Features
Reusable Backoff Utility (
src/lib/backoff.ts)withExponentialBackoff()function that can wrap any async functionwithCalendarRetry()with Calendar API-optimized defaultsRate Limit Detection
rateLimitExceeded,userRateLimitExceeded,quotaExceeded,dailyLimitExceededExponential Backoff Strategy
baseDelay * 2^attempt🔧 Implementation
Enhanced Google Meet Creation
Usage Examples
✅ Benefits
🧪 Testing
The retry logic only activates for rate limit errors - all other errors (authentication, validation, etc.) continue to fail fast as expected.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
fonts.googleapis.com/usr/local/bin/node /home/REDACTED/work/schedulo/schedulo/node_modules/next/dist/compiled/jest-worker/processChild.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
This pull request was created as a result of the following prompt from Copilot chat.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.