Skip to content

Commit dad03e7

Browse files
committed
Skip delay after last attachment upload
1 parent 1d3c4f2 commit dad03e7

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎src/publish/confluence/confluence.ts‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,11 @@ async function publish(
438438

439439
const uploadAttachmentsResult: unknown[] = [];
440440

441-
for (const att of attachmentsToUpload) {
441+
for (let i = 0; i < attachmentsToUpload.length; i++) {
442442
// Start exactly ONE upload by calling the helper with a single attachment
443443
const tasks = uploadAttachments(
444444
publishFiles.baseDir,
445-
[att], // <-- one at a time
445+
[attachmentsToUpload[i]], // <-- one at a time
446446
toUpdate.id,
447447
fileName,
448448
existingAttachments,
@@ -451,10 +451,12 @@ async function publish(
451451
const res = await tasks[0];
452452
uploadAttachmentsResult.push(res);
453453

454-
// short backoff between uploads
455-
const t0 = performance.now();
456-
await sleep(ATTACHMENT_UPLOAD_DELAY_MS);
457-
trace("[ATTACHMENT] sleptMs", { ms: Math.round(performance.now() - t0) }, LogPrefix.ATTACHMENT);
454+
if (i < attachmentsToUpload.length - 1) {
455+
// short backoff between uploads
456+
const t0 = performance.now();
457+
await sleep(ATTACHMENT_UPLOAD_DELAY_MS);
458+
trace("[ATTACHMENT] sleptMs", { ms: Math.round(performance.now() - t0) }, LogPrefix.ATTACHMENT);
459+
}
458460
}
459461
trace(
460462
"uploadAttachmentsResult",

0 commit comments

Comments
 (0)