File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed
apps/sim/lib/webhooks/polling Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -140,8 +140,10 @@ export const googleCalendarPollingHandler: PollingProviderHandler = {
140140 logger
141141 )
142142
143- // Use the latest `updated` value from response to avoid clock skew
144- const newTimestamp = latestUpdated || now . toISOString ( )
143+ const newTimestamp =
144+ processedCount === 0 && failedCount > 0
145+ ? config . lastCheckedTimestamp
146+ : latestUpdated || now . toISOString ( )
145147 await updateWebhookProviderConfig ( webhookId , { lastCheckedTimestamp : newTimestamp } , logger )
146148
147149 if ( failedCount > 0 && processedCount === 0 ) {
Original file line number Diff line number Diff line change @@ -151,9 +151,13 @@ export const googleDrivePollingHandler: PollingProviderHandler = {
151151 MAX_KNOWN_FILE_IDS
152152 )
153153
154+ const allFailed = processedCount === 0 && failedCount > 0
154155 await updateWebhookProviderConfig (
155156 webhookId ,
156- { pageToken : newStartPageToken , knownFileIds : mergedKnownIds } ,
157+ {
158+ pageToken : allFailed ? config . pageToken : newStartPageToken ,
159+ knownFileIds : allFailed ? existingKnownIds : mergedKnownIds ,
160+ } ,
157161 logger
158162 )
159163
Original file line number Diff line number Diff line change @@ -182,14 +182,8 @@ export const googleSheetsPollingHandler: PollingProviderHandler = {
182182 logger
183183 )
184184
185- // Advance row count only by successfully processed rows so failed rows
186- // can be retried on the next poll cycle. Idempotency deduplicates the
187- // already-processed rows when they are re-fetched.
188- const rowsAdvanced = failedCount > 0 ? processedCount : rowsToFetch
185+ const rowsAdvanced = failedCount > 0 ? 0 : rowsToFetch
189186 const newLastKnownRowCount = config . lastKnownRowCount + rowsAdvanced
190- // When batching (more rows than maxRowsPerPoll) or retrying failed rows,
191- // keep the old lastModifiedTime so the Drive pre-check doesn't skip
192- // remaining/retried rows on the next poll.
193187 const hasRemainingOrFailed = rowsAdvanced < newRowCount
194188 await updateWebhookProviderConfig (
195189 webhookId ,
You can’t perform that action at this time.
0 commit comments