From 9afbe2c1a72b520a69cce90f9cfb02d63aa32658 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Fri, 17 Nov 2023 11:37:22 +0800 Subject: [PATCH] update taskName to null when no data to import --- packages/integration-handler/src/index.ts | 48 +++++++++++------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/integration-handler/src/index.ts b/packages/integration-handler/src/index.ts index bb27136cd..30de57935 100644 --- a/packages/integration-handler/src/index.ts +++ b/packages/integration-handler/src/index.ts @@ -251,33 +251,33 @@ export const importer = Sentry.GCPFunction.wrapHttpFunction( total: offset, size: retrievedData.length, }) - - console.log('updating integration...', { - userId, - integrationId: req.body.integrationId, - syncedAt, - }) - // update the integration's syncedAt and remove taskName - const result = await updateIntegration( - REST_BACKEND_ENDPOINT, - req.body.integrationId, - new Date(syncedAt), - req.body.integrationName, - claims.token, - token, - 'IMPORT', - null - ) - if (!result) { - console.error('failed to update integration', { - userId, - integrationId: req.body.integrationId, - }) - return res.status(400).send('Failed to update integration') - } } while (retrievedData.length > 0 && offset < 20000) // limit to 20k pages } + console.log('updating integration...', { + userId, + integrationId: req.body.integrationId, + syncedAt, + }) + // update the integration's syncedAt and remove taskName + const result = await updateIntegration( + REST_BACKEND_ENDPOINT, + req.body.integrationId, + new Date(syncedAt), + req.body.integrationName, + claims.token, + token, + 'IMPORT', + null + ) + if (!result) { + console.error('failed to update integration', { + userId, + integrationId: req.body.integrationId, + }) + return res.status(500).send('Failed to update integration') + } + console.log('done') } catch (err) { console.error('import pages from integration failed', {