mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
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:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user