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)
This commit is contained in:
Waleed Latif
2026-04-09 14:52:32 -07:00
committed by waleed
parent 9df3c078ae
commit d32e1cbb81
2 changed files with 5 additions and 4 deletions

View File

@@ -87,7 +87,6 @@ export const googleDrivePollingHandler: PollingProviderHandler = {
)
const config = webhookData.providerConfig as unknown as GoogleDriveWebhookConfig
const now = new Date()
// First poll: get startPageToken and seed state
if (!config.pageToken) {

View File

@@ -95,7 +95,7 @@ export const googleSheetsPollingHandler: PollingProviderHandler = {
webhookId,
{
lastKnownRowCount: currentRowCount,
lastModifiedTime: currentModifiedTime,
lastModifiedTime: currentModifiedTime ?? config.lastModifiedTime,
lastCheckedTimestamp: now.toISOString(),
},
logger
@@ -118,7 +118,7 @@ export const googleSheetsPollingHandler: PollingProviderHandler = {
webhookId,
{
lastKnownRowCount: currentRowCount,
lastModifiedTime: currentModifiedTime,
lastModifiedTime: currentModifiedTime ?? config.lastModifiedTime,
lastCheckedTimestamp: now.toISOString(),
},
logger
@@ -195,7 +195,9 @@ export const googleSheetsPollingHandler: PollingProviderHandler = {
webhookId,
{
lastKnownRowCount: newLastKnownRowCount,
lastModifiedTime: hasRemainingOrFailed ? config.lastModifiedTime : currentModifiedTime,
lastModifiedTime: hasRemainingOrFailed
? config.lastModifiedTime
: (currentModifiedTime ?? config.lastModifiedTime),
lastCheckedTimestamp: now.toISOString(),
},
logger