Skip to content

Commit 3d6edeb

Browse files
committed
fix(polling): remove unused variable and preserve lastModifiedTime on Drive API failure
- Remove unused `now` variable from Google Drive polling handler - Preserve stored lastModifiedTime when Drive API pre-check fails (previously wrote undefined, disabling the optimization until the next successful Drive API call)
1 parent 6411bf2 commit 3d6edeb

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ export const googleDrivePollingHandler: PollingProviderHandler = {
8787
)
8888

8989
const config = webhookData.providerConfig as unknown as GoogleDriveWebhookConfig
90-
const now = new Date()
9190

9291
// First poll: get startPageToken and seed state
9392
if (!config.pageToken) {

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const googleSheetsPollingHandler: PollingProviderHandler = {
9595
webhookId,
9696
{
9797
lastKnownRowCount: currentRowCount,
98-
lastModifiedTime: currentModifiedTime,
98+
lastModifiedTime: currentModifiedTime ?? config.lastModifiedTime,
9999
lastCheckedTimestamp: now.toISOString(),
100100
},
101101
logger
@@ -118,7 +118,7 @@ export const googleSheetsPollingHandler: PollingProviderHandler = {
118118
webhookId,
119119
{
120120
lastKnownRowCount: currentRowCount,
121-
lastModifiedTime: currentModifiedTime,
121+
lastModifiedTime: currentModifiedTime ?? config.lastModifiedTime,
122122
lastCheckedTimestamp: now.toISOString(),
123123
},
124124
logger
@@ -195,7 +195,9 @@ export const googleSheetsPollingHandler: PollingProviderHandler = {
195195
webhookId,
196196
{
197197
lastKnownRowCount: newLastKnownRowCount,
198-
lastModifiedTime: hasRemainingOrFailed ? config.lastModifiedTime : currentModifiedTime,
198+
lastModifiedTime: hasRemainingOrFailed
199+
? config.lastModifiedTime
200+
: (currentModifiedTime ?? config.lastModifiedTime),
199201
lastCheckedTimestamp: now.toISOString(),
200202
},
201203
logger

0 commit comments

Comments
 (0)