feat: implement googleapis caching layer for Google Calendar API calls#22184
feat: implement googleapis caching layer for Google Calendar API calls#22184
Conversation
- Add framework-agnostic caching system supporting Next.js Edge Cache and Redis - Implement request signature-based deduplication with 30-second default TTL - Support read operations (events.list, events.get, freebusy.query, calendarList.list) - Add per-credential cache isolation for security - Include comprehensive documentation and testing infrastructure - Integrate with booking flow through optional dependency injection - Add NestJS module for Redis cache support in API v2 Based on PR #21933 with updates for main branch compatibility Co-Authored-By: zomars@cal.com <zomars@me.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
|
✅ No security or compliance issues detected. Reviewed everything up to 5a637a0. Security Overview
Detected Code Changes
Reply to this PR with |
Co-Authored-By: zomars@cal.com <zomars@me.com>
- Change crypto import from default to namespace import to fix ES5 compatibility - Replace Array.from(Map.entries()) with forEach for ES5-compatible Map iteration - Ensures GoogleApiCache compiles correctly with react-library.json ES5 target Co-Authored-By: zomars@cal.com <zomars@me.com>
E2E results are ready! |
|
This PR is being marked as stale due to inactivity. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Closing for now as work is continuing in #23675 |
Implement googleapis caching layer for Google Calendar API calls
Summary
This PR implements a comprehensive caching layer for Google Calendar API calls to prevent rate limiting and improve performance. The implementation provides:
events.list,events.get,freebusy.query, andcalendarList.listThe core implementation is located in
packages/app-store/_utils/googleapis/with minimal integration points in the booking flow. The cache manager is passed as an optional parameter throughhandleNewBooking→EventManager→ calendar integrations.Review & Testing Checklist for Human
HIGH RISK - 5 critical items to verify:
googleApiCacheManageris undefined and when it's providedRecommended test plan:
node packages/app-store/_utils/googleapis/test-googleapis-cache-integration.jsDiagram
%%{ init : { "theme" : "default" }}%% graph TD A["apps/web/pages/api/book/event.ts"]:::major-edit --> B["GoogleApiCacheFactory.createEdgeCacheManager()"]:::major-edit A --> C["handleNewBooking()"]:::minor-edit C --> D["packages/features/bookings/lib/handleNewBooking.ts"]:::minor-edit D --> E["EventManager()"]:::minor-edit E --> F["packages/lib/EventManager.ts"]:::minor-edit F --> G["Calendar integrations"]:::context B --> H["packages/app-store/_utils/googleapis/GoogleApiCacheFactory.ts"]:::major-edit H --> I["packages/app-store/_utils/googleapis/CachedFetchManager.ts"]:::major-edit I --> J["packages/app-store/_utils/googleapis/GoogleApiCache.ts"]:::major-edit I --> K["packages/app-store/_utils/googleapis/CacheClient.ts"]:::major-edit L["apps/api/v2/src/modules/googleapis-cache/"]:::major-edit --> M["NestJS Redis Integration"]:::major-edit N["packages/app-store/_utils/googleapis/TESTING.md"]:::major-edit O["packages/app-store/_utils/googleapis/README.md"]:::major-edit P["packages/app-store/_utils/googleapis/test-*.js"]:::major-edit subgraph Legend L1["Major Edit"]:::major-edit L2["Minor Edit"]:::minor-edit L3["Context/No Edit"]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes