Skip to content

Commit

Permalink
rework request timer
Browse files Browse the repository at this point in the history
  • Loading branch information
zemberdotnet committed Oct 18, 2023
1 parent c8ece42 commit 1b4fbef
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions packages/integration-sdk-runtime/src/synchronization/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down

0 comments on commit 1b4fbef

Please sign in to comment.