diff --git a/packages/integration-sdk-runtime/src/synchronization/index.ts b/packages/integration-sdk-runtime/src/synchronization/index.ts index ed9f99486..c9678f584 100644 --- a/packages/integration-sdk-runtime/src/synchronization/index.ts +++ b/packages/integration-sdk-runtime/src/synchronization/index.ts @@ -481,6 +481,7 @@ export async function uploadDataChunk< 'Uploading data...', ); + const startTime = Date.now(); if (compressUploads) { const buf = await gzipData({ [type]: batch }); await apiClient.post( @@ -507,32 +508,30 @@ export async function uploadDataChunk< }, }, ); - - const startTime = Date.now(); - const duration = Date.now() - startTime; - if (duration >= 10_000) { - logger.info( - { - uploadCorrelationId, - uploadType: type, - attemptNum: ctx.attemptNum, - batchSize: batch.length, - batchSizeInBytes: getSizeOfObject(batch), - uploadDuration: duration, - }, - 'Finished uploading big batch', - ); - } - logger.debug( + } + const duration = Date.now() - startTime; + if (duration >= 10_000) { + logger.info( { uploadCorrelationId, uploadType: type, attemptNum: ctx.attemptNum, batchSize: batch.length, + batchSizeInBytes: getSizeOfObject(batch), + uploadDuration: duration, }, - 'Finished uploading batch', + 'Finished uploading big batch', ); } + logger.debug( + { + uploadCorrelationId, + uploadType: type, + attemptNum: ctx.attemptNum, + batchSize: batch.length, + }, + 'Finished uploading batch', + ); }, { maxAttempts: 5,