BT-0261: Optimize Outlook Calendar Cache with Graph Change Notifications#1
Open
BT-0261: Optimize Outlook Calendar Cache with Graph Change Notifications#1
Conversation
…ndividual users This commit enables the calendar cache for Microsoft Outlook (Office365) calendars by updating isCalendarTypeSupported to include 'office365_calendar'. Key changes: 1. CalendarCacheEventService.isCalendarTypeSupported: Added office365_calendar to the list of supported calendar types, enabling the cache wrapper for Outlook calendars. 2. SelectedCalendarRepository.findNextSubscriptionBatch: Modified the query to also return calendars for users not in any team, ensuring individual users also get their calendars subscribed for change notifications. 3. Updated the corresponding test to expect office365_calendar to return true. With these changes: - Office365 calendars will now use the CalendarCacheWrapper when the calendar-subscription-cache feature flag is enabled - The cache will store calendar events and serve them from the database instead of querying Microsoft Graph on every public page visit - Individual users (not just team members) will have their calendars subscribed for Microsoft Graph change notifications - When a calendar change notification is received, the cache will be updated automatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR enables the Microsoft Outlook (Office365) calendar cache to reduce the number of Microsoft Graph API calls when checking calendar availability on public event type pages.
Problem
Currently, for Microsoft Outlook calendars, Cal.com checks every single connected calendar whenever a user event type public page is visited. This works well for most cases but can become expensive as more calendars are added, especially for team events where multiple users' calendars need to be checked for round-robin scheduling.
Solution
This PR implements the following optimizations:
1. Enable Office365 Calendar Cache (CalendarCacheEventService.isCalendarTypeSupported)
The calendar cache was explicitly disabled for Office365 calendars. This change enables it:
2. Expand Subscription to Individual Users (SelectedCalendarRepository.findNextSubscriptionBatch)
Previously, the subscription batch query only returned calendars for users in teams with the feature flag enabled. This change also includes users not in any team, ensuring individual users also benefit from cached calendar data:
How It Works
Testing
Updated the corresponding test to expect office365_calendar to return true for isCalendarTypeSupported.
Related Issues