From 851675c5591dcab1070183f0ed1b1a788de07d2c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Aug 2021 15:13:41 +0200 Subject: [PATCH] Rename jobs list command --- server/tests/api/server/handle-down.ts | 2 +- server/tests/api/server/jobs.ts | 8 ++++---- server/tests/api/videos/video-transcoder.ts | 2 +- shared/extra-utils/server/jobs-command.ts | 4 ++-- shared/extra-utils/server/jobs.ts | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index 2f3950354..b3255a721 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts @@ -161,7 +161,7 @@ describe('Test handle downs', function () { const states: JobState[] = [ 'waiting', 'active' ] for (const state of states) { - const body = await servers[0].jobs.getJobsList({ + const body = await servers[0].jobs.list({ state: state, start: 0, count: 50, diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts index c10c154c2..937028e4f 100644 --- a/server/tests/api/server/jobs.ts +++ b/server/tests/api/server/jobs.ts @@ -38,14 +38,14 @@ describe('Test jobs', function () { }) it('Should list jobs', async function () { - const body = await servers[1].jobs.getJobsList({ state: 'completed' }) + const body = await servers[1].jobs.list({ state: 'completed' }) expect(body.total).to.be.above(2) expect(body.data).to.have.length.above(2) }) it('Should list jobs with sort, pagination and job type', async function () { { - const body = await servers[1].jobs.getJobsList({ + const body = await servers[1].jobs.list({ state: 'completed', start: 1, count: 2, @@ -66,7 +66,7 @@ describe('Test jobs', function () { } { - const body = await servers[1].jobs.getJobsList({ + const body = await servers[1].jobs.list({ state: 'completed', start: 0, count: 100, @@ -82,7 +82,7 @@ describe('Test jobs', function () { }) it('Should list all jobs', async function () { - const body = await servers[1].jobs.getJobsList() + const body = await servers[1].jobs.list() expect(body.total).to.be.above(2) const jobs = body.data diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index f67752d69..2b49176b2 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts @@ -693,7 +693,7 @@ describe('Test video transcoding', function () { describe('Transcoding job queue', function () { it('Should have the appropriate priorities for transcoding jobs', async function () { - const body = await servers[1].jobs.getJobsList({ + const body = await servers[1].jobs.list({ start: 0, count: 100, sort: '-createdAt', diff --git a/shared/extra-utils/server/jobs-command.ts b/shared/extra-utils/server/jobs-command.ts index 91771c176..f28397816 100644 --- a/shared/extra-utils/server/jobs-command.ts +++ b/shared/extra-utils/server/jobs-command.ts @@ -8,14 +8,14 @@ export class JobsCommand extends AbstractCommand { async getLatest (options: OverrideCommandOptions & { jobType: JobType }) { - const { data } = await this.getJobsList({ ...options, start: 0, count: 1, sort: '-createdAt' }) + const { data } = await this.list({ ...options, start: 0, count: 1, sort: '-createdAt' }) if (data.length === 0) return undefined return data[0] } - getJobsList (options: OverrideCommandOptions & { + list (options: OverrideCommandOptions & { state?: JobState jobType?: JobType start?: number diff --git a/shared/extra-utils/server/jobs.ts b/shared/extra-utils/server/jobs.ts index 27104bfdf..79b8c3183 100644 --- a/shared/extra-utils/server/jobs.ts +++ b/shared/extra-utils/server/jobs.ts @@ -25,7 +25,7 @@ async function waitJobs (serversArg: PeerTubeServer[] | PeerTubeServer, skipDela // Check if each server has pending request for (const server of servers) { for (const state of states) { - const p = server.jobs.getJobsList({ + const p = server.jobs.list({ state, start: 0, count: 10,