diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-25 15:13:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-26 10:01:42 +0200 |
commit | 851675c5591dcab1070183f0ed1b1a788de07d2c (patch) | |
tree | 9553ea2d73b5077f3b51345eeca8acbac48b4bd7 | |
parent | 0d22b7ad5ffea0a830a266815f7bdfd8893917c9 (diff) | |
download | PeerTube-851675c5591dcab1070183f0ed1b1a788de07d2c.tar.gz PeerTube-851675c5591dcab1070183f0ed1b1a788de07d2c.tar.zst PeerTube-851675c5591dcab1070183f0ed1b1a788de07d2c.zip |
Rename jobs list command
-rw-r--r-- | server/tests/api/server/handle-down.ts | 2 | ||||
-rw-r--r-- | server/tests/api/server/jobs.ts | 8 | ||||
-rw-r--r-- | server/tests/api/videos/video-transcoder.ts | 2 | ||||
-rw-r--r-- | shared/extra-utils/server/jobs-command.ts | 4 | ||||
-rw-r--r-- | 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 () { | |||
161 | const states: JobState[] = [ 'waiting', 'active' ] | 161 | const states: JobState[] = [ 'waiting', 'active' ] |
162 | 162 | ||
163 | for (const state of states) { | 163 | for (const state of states) { |
164 | const body = await servers[0].jobs.getJobsList({ | 164 | const body = await servers[0].jobs.list({ |
165 | state: state, | 165 | state: state, |
166 | start: 0, | 166 | start: 0, |
167 | count: 50, | 167 | 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 () { | |||
38 | }) | 38 | }) |
39 | 39 | ||
40 | it('Should list jobs', async function () { | 40 | it('Should list jobs', async function () { |
41 | const body = await servers[1].jobs.getJobsList({ state: 'completed' }) | 41 | const body = await servers[1].jobs.list({ state: 'completed' }) |
42 | expect(body.total).to.be.above(2) | 42 | expect(body.total).to.be.above(2) |
43 | expect(body.data).to.have.length.above(2) | 43 | expect(body.data).to.have.length.above(2) |
44 | }) | 44 | }) |
45 | 45 | ||
46 | it('Should list jobs with sort, pagination and job type', async function () { | 46 | it('Should list jobs with sort, pagination and job type', async function () { |
47 | { | 47 | { |
48 | const body = await servers[1].jobs.getJobsList({ | 48 | const body = await servers[1].jobs.list({ |
49 | state: 'completed', | 49 | state: 'completed', |
50 | start: 1, | 50 | start: 1, |
51 | count: 2, | 51 | count: 2, |
@@ -66,7 +66,7 @@ describe('Test jobs', function () { | |||
66 | } | 66 | } |
67 | 67 | ||
68 | { | 68 | { |
69 | const body = await servers[1].jobs.getJobsList({ | 69 | const body = await servers[1].jobs.list({ |
70 | state: 'completed', | 70 | state: 'completed', |
71 | start: 0, | 71 | start: 0, |
72 | count: 100, | 72 | count: 100, |
@@ -82,7 +82,7 @@ describe('Test jobs', function () { | |||
82 | }) | 82 | }) |
83 | 83 | ||
84 | it('Should list all jobs', async function () { | 84 | it('Should list all jobs', async function () { |
85 | const body = await servers[1].jobs.getJobsList() | 85 | const body = await servers[1].jobs.list() |
86 | expect(body.total).to.be.above(2) | 86 | expect(body.total).to.be.above(2) |
87 | 87 | ||
88 | const jobs = body.data | 88 | 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 () { | |||
693 | describe('Transcoding job queue', function () { | 693 | describe('Transcoding job queue', function () { |
694 | 694 | ||
695 | it('Should have the appropriate priorities for transcoding jobs', async function () { | 695 | it('Should have the appropriate priorities for transcoding jobs', async function () { |
696 | const body = await servers[1].jobs.getJobsList({ | 696 | const body = await servers[1].jobs.list({ |
697 | start: 0, | 697 | start: 0, |
698 | count: 100, | 698 | count: 100, |
699 | sort: '-createdAt', | 699 | 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 { | |||
8 | async getLatest (options: OverrideCommandOptions & { | 8 | async getLatest (options: OverrideCommandOptions & { |
9 | jobType: JobType | 9 | jobType: JobType |
10 | }) { | 10 | }) { |
11 | const { data } = await this.getJobsList({ ...options, start: 0, count: 1, sort: '-createdAt' }) | 11 | const { data } = await this.list({ ...options, start: 0, count: 1, sort: '-createdAt' }) |
12 | 12 | ||
13 | if (data.length === 0) return undefined | 13 | if (data.length === 0) return undefined |
14 | 14 | ||
15 | return data[0] | 15 | return data[0] |
16 | } | 16 | } |
17 | 17 | ||
18 | getJobsList (options: OverrideCommandOptions & { | 18 | list (options: OverrideCommandOptions & { |
19 | state?: JobState | 19 | state?: JobState |
20 | jobType?: JobType | 20 | jobType?: JobType |
21 | start?: number | 21 | 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 | |||
25 | // Check if each server has pending request | 25 | // Check if each server has pending request |
26 | for (const server of servers) { | 26 | for (const server of servers) { |
27 | for (const state of states) { | 27 | for (const state of states) { |
28 | const p = server.jobs.getJobsList({ | 28 | const p = server.jobs.list({ |
29 | state, | 29 | state, |
30 | start: 0, | 30 | start: 0, |
31 | count: 10, | 31 | count: 10, |