File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -435,15 +435,26 @@ async function publish(
435435 LogPrefix . ATTACHMENT ,
436436 ) ;
437437
438- const uploadAttachmentsResult = await Promise . all (
439- uploadAttachments (
440- publishFiles . baseDir ,
441- attachmentsToUpload ,
442- toUpdate . id ,
443- fileName ,
444- existingAttachments ,
445- ) ,
446- ) ;
438+ const uploadAttachmentsResult : unknown [ ] = [ ] ;
439+
440+ for ( const att of attachmentsToUpload ) {
441+ // Start exactly ONE upload by calling the helper with a single attachment
442+ const tasks = uploadAttachments (
443+ publishFiles . baseDir ,
444+ [ att ] , // <-- one at a time
445+ toUpdate . id ,
446+ fileName ,
447+ existingAttachments ,
448+ ) as Promise < unknown > [ ] ; // uploadAttachments returns an array of Promises
449+
450+ const res = await tasks [ 0 ] ;
451+ uploadAttachmentsResult . push ( res ) ;
452+
453+ // short backoff (milliseconds)
454+ const t0 = performance . now ( ) ;
455+ await new Promise < void > ( r => setTimeout ( r , 800 ) ) ; // 0.8s
456+ trace ( "[ATTACHMENT] sleptMs" , { ms : Math . round ( performance . now ( ) - t0 ) } , LogPrefix . ATTACHMENT ) ;
457+ }
447458 trace (
448459 "uploadAttachmentsResult" ,
449460 uploadAttachmentsResult ,
You can’t perform that action at this time.
0 commit comments