- const p = getJobsListPaginationAndSort(server.url, server.accessToken, 0, 10, '-createdAt')
- .then(res => {
- const jobs = res.body.data
-
- for (const job of jobs) {
- if (job.state === 'pending' || job.state === 'processing') {
- pendingRequests = true
- }
- }
- })
-
- tasks.push(p)
+ for (const state of states) {
+ const p = getJobsListPaginationAndSort(server.url, server.accessToken, state, 0, 10, '-createdAt')
+ .then(res => {
+ if (res.body.total > 0) pendingRequests = true
+ })
+ tasks.push(p)
+ }