fix(granola): add incremental sync with early termination#436
Open
aculich wants to merge 1 commit intorowboatlabs:mainfrom
Open
fix(granola): add incremental sync with early termination#436aculich wants to merge 1 commit intorowboatlabs:mainfrom
aculich wants to merge 1 commit intorowboatlabs:mainfrom
Conversation
The Granola sync was fetching all documents from the API on every sync, even when most had not changed. This adds two improvements: 1. Pass updated_since parameter to the API (if supported, will reduce docs returned; if ignored, fallback kicks in) 2. Early termination after 20 consecutive unchanged documents, stopping the pagination loop when we reach the older unchanged portion This significantly reduces API calls and sync time for users with many Granola meetings. Made-with: Cursor
|
@aculich is attempting to deploy a commit to the RowBoat Labs Team on Vercel. A member of the Team first needs to authorize it. |
|
This still looks like the right direction for #435. The issue description itself already proposes basically this two-part approach: try Right now the main blocker seems to be that the branch is conflicted with |
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
Reduces API calls and sync time for Granola integration by:
updated_sinceparameter to the API (works if API supports it)Fixes #435
Problem
The Granola sync fetches ALL documents from the API on every sync cycle, even when most documents haven't changed. With 500 meetings, this means ~50 API calls with 1-second delays = 50+ seconds per sync, even when nothing changed.
Solution
Dual strategy with graceful fallback:
Try
updated_sinceparameter - If the Granola API accepts this parameter, it will return only documents updated since the last sync, drastically reducing API calls.Early termination fallback - If the API ignores the parameter (returning all docs anyway), the sync stops after hitting 20 consecutive documents that haven't changed since the last sync. This works because the API typically returns documents in a consistent order.
Changes
apps/x/packages/core/src/knowledge/granola/sync.ts:EARLY_TERMINATION_STREAK = 20constantgetDocuments()to accept optionalupdatedSinceparameterstate.lastSyncDateto API request asupdated_sinceunchangedStreakcounter in sync loopTesting
Impact
Made with Cursor