diff --git a/src/publish/confluence/confluence.ts b/src/publish/confluence/confluence.ts index 99233cac9b8..8ad69d6bc27 100644 --- a/src/publish/confluence/confluence.ts +++ b/src/publish/confluence/confluence.ts @@ -435,15 +435,26 @@ async function publish( LogPrefix.ATTACHMENT, ); - const uploadAttachmentsResult = await Promise.all( - uploadAttachments( - publishFiles.baseDir, - attachmentsToUpload, - toUpdate.id, - fileName, - existingAttachments, - ), - ); + const uploadAttachmentsResult: unknown[] = []; + + for (const att of attachmentsToUpload) { + // Start exactly ONE upload by calling the helper with a single attachment + const tasks = uploadAttachments( + publishFiles.baseDir, + [att], // <-- one at a time + toUpdate.id, + fileName, + existingAttachments, + ) as Promise[]; // uploadAttachments returns an array of Promises + + const res = await tasks[0]; + uploadAttachmentsResult.push(res); + + // short backoff (milliseconds) + const t0 = performance.now(); + await new Promise(r => setTimeout(r, 800)); // 0.8s + trace("[ATTACHMENT] sleptMs", { ms: Math.round(performance.now() - t0) }, LogPrefix.ATTACHMENT); + } trace( "uploadAttachmentsResult", uploadAttachmentsResult,