Skip to content

Commit 25c93cc

Browse files
committed
perf(sanity): optimize bulk job polling - reduce timeout from 90s to 30s
- Reduced maxAttempts from 15 to 8 - Reduced delay from 5s to 3s - Total max polling time: 24s (was 75s) - Test timeout: 30s (was 90s) - Faster test execution now that bulk job route is fixed
1 parent 33db55b commit 25c93cc

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

test/sanity-check/api/bulkOperation-test.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function assetsWithValidUids () {
4040
return [assetUid1, assetUid2].filter(uid => uid && String(uid).trim()).map(uid => ({ uid }))
4141
}
4242

43-
async function waitForJobReady (jobId, maxAttempts = 15) {
43+
async function waitForJobReady (jobId, maxAttempts = 8) {
4444
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
4545
try {
4646
const response = await doBulkOperation()
@@ -51,7 +51,7 @@ async function waitForJobReady (jobId, maxAttempts = 15) {
5151
} catch (error) {
5252
// retry
5353
}
54-
await delay(5000)
54+
await delay(3000)
5555
}
5656
throw new Error(`Job ${jobId} did not become ready after ${maxAttempts} attempts`)
5757
}
@@ -360,7 +360,7 @@ describe('BulkOperation api test', () => {
360360
})
361361

362362
it('should wait for jobs to be ready and get job status for the first publish job', async function () {
363-
this.timeout(90000)
363+
this.timeout(30000)
364364

365365
const response = await waitForJobReady(jobId1)
366366
expect(response).to.not.equal(undefined)
@@ -384,7 +384,7 @@ describe('BulkOperation api test', () => {
384384
})
385385

386386
it('should get job status for the second publish job', async function () {
387-
this.timeout(90000)
387+
this.timeout(30000)
388388

389389
const response = await waitForJobReady(jobId2)
390390
expect(response).to.not.equal(undefined)
@@ -396,7 +396,7 @@ describe('BulkOperation api test', () => {
396396
})
397397

398398
it('should get job status for the third publish job', async function () {
399-
this.timeout(90000)
399+
this.timeout(30000)
400400

401401
const response = await waitForJobReady(jobId3)
402402
expect(response).to.not.equal(undefined)
@@ -408,7 +408,7 @@ describe('BulkOperation api test', () => {
408408
})
409409

410410
it('should get job status for publishAllLocalized=true job', async function () {
411-
this.timeout(90000)
411+
this.timeout(30000)
412412

413413
const response = await waitForJobReady(jobId4)
414414
expect(response).to.not.equal(undefined)
@@ -420,7 +420,7 @@ describe('BulkOperation api test', () => {
420420
})
421421

422422
it('should get job status for publishAllLocalized=false job', async function () {
423-
this.timeout(90000)
423+
this.timeout(30000)
424424

425425
const response = await waitForJobReady(jobId5)
426426
expect(response).to.not.equal(undefined)
@@ -432,7 +432,7 @@ describe('BulkOperation api test', () => {
432432
})
433433

434434
it('should get job status for asset publishAllLocalized job', async function () {
435-
this.timeout(90000)
435+
this.timeout(30000)
436436

437437
const response = await waitForJobReady(jobId6)
438438
expect(response).to.not.equal(undefined)
@@ -444,7 +444,7 @@ describe('BulkOperation api test', () => {
444444
})
445445

446446
it('should get job status for unpublishAllLocalized=true job', async function () {
447-
this.timeout(90000)
447+
this.timeout(30000)
448448

449449
const response = await waitForJobReady(jobId7)
450450
expect(response).to.not.equal(undefined)
@@ -456,7 +456,7 @@ describe('BulkOperation api test', () => {
456456
})
457457

458458
it('should get job status for unpublishAllLocalized=false job', async function () {
459-
this.timeout(90000)
459+
this.timeout(30000)
460460

461461
const response = await waitForJobReady(jobId8)
462462
expect(response).to.not.equal(undefined)
@@ -468,7 +468,7 @@ describe('BulkOperation api test', () => {
468468
})
469469

470470
it('should get job status for asset unpublishAllLocalized job', async function () {
471-
this.timeout(90000)
471+
this.timeout(30000)
472472

473473
const response = await waitForJobReady(jobId9)
474474
expect(response).to.not.equal(undefined)
@@ -480,7 +480,7 @@ describe('BulkOperation api test', () => {
480480
})
481481

482482
it('should get job status for multiple parameters job', async function () {
483-
this.timeout(90000)
483+
this.timeout(30000)
484484

485485
const response = await waitForJobReady(jobId10)
486486
expect(response).to.not.equal(undefined)
@@ -492,7 +492,7 @@ describe('BulkOperation api test', () => {
492492
})
493493

494494
it('should get job status with bulk_version parameter', async function () {
495-
this.timeout(90000)
495+
this.timeout(30000)
496496

497497
await waitForJobReady(jobId1)
498498
const response = await doBulkOperationWithManagementToken(tokenUidDev)
@@ -506,7 +506,7 @@ describe('BulkOperation api test', () => {
506506
})
507507

508508
it('should get job items for a completed job', async function () {
509-
this.timeout(90000)
509+
this.timeout(30000)
510510

511511
await waitForJobReady(jobId1)
512512
const response = await doBulkOperationWithManagementToken(tokenUidDev)
@@ -516,7 +516,7 @@ describe('BulkOperation api test', () => {
516516
})
517517

518518
it('should get job items with explicit api_version', async function () {
519-
this.timeout(90000)
519+
this.timeout(30000)
520520

521521
await waitForJobReady(jobId2)
522522
const response = await doBulkOperationWithManagementToken(tokenUidDev)

0 commit comments

Comments
 (0)