File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -40,11 +40,15 @@ function assetsWithValidUids () {
4040 return [ assetUid1 , assetUid2 ] . filter ( uid => uid && String ( uid ) . trim ( ) ) . map ( uid => ( { uid } ) )
4141}
4242
43- async function waitForJobReady ( jobId , maxAttempts = 5 ) {
43+ async function waitForJobReady ( jobId , maxAttempts = 3 ) {
4444 for ( let attempt = 1 ; attempt <= maxAttempts ; attempt ++ ) {
4545 try {
46- const response = await doBulkOperation ( )
47- . jobStatus ( { job_id : jobId , api_version : '3.2' } )
46+ // GET /v3/bulk/jobs/{job_id} on AM2.0 requires management token auth (authtoken returns 401)
47+ // Fall back to authtoken if management token not yet available
48+ const bulkOp = tokenUidDev
49+ ? doBulkOperationWithManagementToken ( tokenUidDev )
50+ : doBulkOperation ( )
51+ const response = await bulkOp . jobStatus ( { job_id : jobId , api_version : '3.2' } )
4852 if ( response && response . status ) {
4953 return response
5054 }
@@ -55,7 +59,7 @@ async function waitForJobReady (jobId, maxAttempts = 5) {
5559 }
5660 // For other errors (network, 5xx), retry
5761 }
58- await delay ( 5000 )
62+ await delay ( 3000 )
5963 }
6064 throw new Error ( `Job ${ jobId } did not become ready after ${ maxAttempts } attempts` )
6165}
You can’t perform that action at this time.
0 commit comments