aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/server/jobs.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/server/jobs.ts')
-rw-r--r--shared/extra-utils/server/jobs.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/shared/extra-utils/server/jobs.ts b/shared/extra-utils/server/jobs.ts
index 11b570f60..b3db885e8 100644
--- a/shared/extra-utils/server/jobs.ts
+++ b/shared/extra-utils/server/jobs.ts
@@ -2,7 +2,6 @@ import * as request from 'supertest'
2import { Job, JobState } from '../../models' 2import { Job, JobState } from '../../models'
3import { wait } from '../miscs/miscs' 3import { wait } from '../miscs/miscs'
4import { ServerInfo } from './servers' 4import { ServerInfo } from './servers'
5import { inspect } from 'util'
6 5
7function getJobsList (url: string, accessToken: string, state: JobState) { 6function getJobsList (url: string, accessToken: string, state: JobState) {
8 const path = '/api/v1/jobs/' + state 7 const path = '/api/v1/jobs/' + state
@@ -37,11 +36,10 @@ async function waitJobs (serversArg: ServerInfo[] | ServerInfo) {
37 else servers = serversArg as ServerInfo[] 36 else servers = serversArg as ServerInfo[]
38 37
39 const states: JobState[] = [ 'waiting', 'active', 'delayed' ] 38 const states: JobState[] = [ 'waiting', 'active', 'delayed' ]
40 let pendingRequests = false 39 let pendingRequests: boolean
41 40
42 function tasksBuilder () { 41 function tasksBuilder () {
43 const tasks: Promise<any>[] = [] 42 const tasks: Promise<any>[] = []
44 pendingRequests = false
45 43
46 // Check if each server has pending request 44 // Check if each server has pending request
47 for (const server of servers) { 45 for (const server of servers) {
@@ -62,6 +60,7 @@ async function waitJobs (serversArg: ServerInfo[] | ServerInfo) {
62 } 60 }
63 61
64 do { 62 do {
63 pendingRequests = false
65 await Promise.all(tasksBuilder()) 64 await Promise.all(tasksBuilder())
66 65
67 // Retry, in case of new jobs were created 66 // Retry, in case of new jobs were created