aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/real-world
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/real-world')
-rw-r--r--server/tests/real-world/real-world.ts21
1 files changed, 9 insertions, 12 deletions
diff --git a/server/tests/real-world/real-world.ts b/server/tests/real-world/real-world.ts
index e41203351..7f67525ed 100644
--- a/server/tests/real-world/real-world.ts
+++ b/server/tests/real-world/real-world.ts
@@ -3,6 +3,7 @@ process.env.NODE_ENV = 'test'
3 3
4import * as program from 'commander' 4import * as program from 'commander'
5import { Video, VideoFile, VideoRateType } from '../../../shared' 5import { Video, VideoFile, VideoRateType } from '../../../shared'
6import { JobState } from '../../../shared/models'
6import { 7import {
7 flushAndRunMultipleServers, 8 flushAndRunMultipleServers,
8 flushTests, follow, 9 flushTests, follow,
@@ -346,23 +347,19 @@ function goodbye () {
346} 347}
347 348
348async function isTherePendingRequests (servers: ServerInfo[]) { 349async function isTherePendingRequests (servers: ServerInfo[]) {
350 const states: JobState[] = [ 'inactive', 'active' ]
349 const tasks: Promise<any>[] = [] 351 const tasks: Promise<any>[] = []
350 let pendingRequests = false 352 let pendingRequests = false
351 353
352 // Check if each server has pending request 354 // Check if each server has pending request
353 for (const server of servers) { 355 for (const server of servers) {
354 const p = getJobsListPaginationAndSort(server.url, server.accessToken, 0, 10, '-createdAt') 356 for (const state of states) {
355 .then(res => { 357 const p = getJobsListPaginationAndSort(server.url, server.accessToken, state, 0, 10, '-createdAt')
356 const jobs = res.body.data 358 .then(res => {
357 359 if (res.body.total > 0) pendingRequests = true
358 for (const job of jobs) { 360 })
359 if (job.state === 'pending' || job.state === 'processing') { 361 tasks.push(p)
360 pendingRequests = true 362 }
361 }
362 }
363 })
364
365 tasks.push(p)
366 } 363 }
367 364
368 await Promise.all(tasks) 365 await Promise.all(tasks)