aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/real-world
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-25 15:05:18 +0100
committerChocobozzz <me@florianbigard.com>2018-01-25 18:41:17 +0100
commit94a5ff8a4a75d75bb9df542a39ce8769e7a7e6a4 (patch)
tree32a9148e0e4567f0c4ffae0412cbed20b84e8873 /server/tests/real-world
parentd765fafc3faf0db9818eb1a07161df1cb1bc0efa (diff)
downloadPeerTube-94a5ff8a4a75d75bb9df542a39ce8769e7a7e6a4.tar.gz
PeerTube-94a5ff8a4a75d75bb9df542a39ce8769e7a7e6a4.tar.zst
PeerTube-94a5ff8a4a75d75bb9df542a39ce8769e7a7e6a4.zip
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.
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)