Skip to content

Commit 66e0188

Browse files
committed
fix(polling): drive cursor stall on full page, calendar latestUpdated past filtered events
1 parent ef82ce6 commit 66e0188

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

apps/sim/lib/webhooks/polling/google-calendar.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,19 +282,19 @@ async function processEvents(
282282
let latestUpdated: string | null = null
283283

284284
for (const event of events) {
285+
// Client-side event type filter — skip before idempotency so filtered events aren't cached
286+
const computedEventType = determineEventType(event)
287+
if (eventTypeFilter && computedEventType !== eventTypeFilter) {
288+
continue
289+
}
290+
285291
// Track the latest `updated` timestamp for clock-skew-free state tracking
286292
if (event.updated) {
287293
if (!latestUpdated || event.updated > latestUpdated) {
288294
latestUpdated = event.updated
289295
}
290296
}
291297

292-
// Client-side event type filter — skip before idempotency so filtered events aren't cached
293-
const computedEventType = determineEventType(event)
294-
if (eventTypeFilter && computedEventType !== eventTypeFilter) {
295-
continue
296-
}
297-
298298
try {
299299
// Idempotency key includes `updated` so re-edits of the same event re-trigger
300300
const idempotencyKey = `${webhookData.id}:${event.id}:${event.updated || event.created || ''}`

apps/sim/lib/webhooks/polling/google-drive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ async function fetchChanges(
260260
const overLimit = allChanges.length >= maxFiles
261261

262262
if (!hasMore || overLimit || pages >= MAX_PAGES) {
263-
if (hasMore && !overLimit) {
263+
if (hasMore) {
264264
lastNextPageToken = data.nextPageToken as string
265265
}
266266
break

0 commit comments

Comments
 (0)