Skip to content

Commit

Permalink
fix: googledrive: handle edge case for empty changes with changes API
Browse files Browse the repository at this point in the history
  • Loading branch information
amuwal committed Dec 23, 2024
1 parent 85e8618 commit cdd41b1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/api/src/filestorage/file/services/googledrive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,16 @@ export class GoogleDriveService implements IFileService {

// Update pageToken for next iteration
pageToken = nextPageToken;
newRemoteCursor = newStartPageToken || nextPageToken;
apiCallCount++;

if (!nextPageToken || apiCallCount >= maxApiCalls) {
newRemoteCursor = newStartPageToken || nextPageToken;
if (nextPageToken && changes.length === 0) {
// edge case where we have no changes but still have a nextPageToken
return {
filesToSync,
moreChangesToFetch: false,
remote_cursor: newRemoteCursor,
};
}
} while (pageToken && apiCallCount < maxApiCalls);

Expand Down

0 comments on commit cdd41b1

Please sign in to comment.