From 94a5ff8a4a75d75bb9df542a39ce8769e7a7e6a4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 25 Jan 2018 15:05:18 +0100 Subject: Move job queue to redis We'll use it as cache in the future. /!\ You'll loose your old jobs (pending jobs too) so upgrade only when you don't have pending job anymore. --- server/tests/real-world/real-world.ts | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'server/tests/real-world/real-world.ts') 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' import * as program from 'commander' import { Video, VideoFile, VideoRateType } from '../../../shared' +import { JobState } from '../../../shared/models' import { flushAndRunMultipleServers, flushTests, follow, @@ -346,23 +347,19 @@ function goodbye () { } async function isTherePendingRequests (servers: ServerInfo[]) { + const states: JobState[] = [ 'inactive', 'active' ] const tasks: Promise[] = [] let pendingRequests = false // Check if each server has pending request for (const server of servers) { - 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) + } } await Promise.all(tasks) -- cgit v1.2.3