Rename jobs list command

This commit is contained in:
Chocobozzz 2021-08-25 15:13:41 +02:00
parent 0d22b7ad5f
commit 851675c559
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
5 changed files with 9 additions and 9 deletions

View File

@ -161,7 +161,7 @@ describe('Test handle downs', function () {
const states: JobState[] = [ 'waiting', 'active' ] const states: JobState[] = [ 'waiting', 'active' ]
for (const state of states) { for (const state of states) {
const body = await servers[0].jobs.getJobsList({ const body = await servers[0].jobs.list({
state: state, state: state,
start: 0, start: 0,
count: 50, count: 50,

View File

@ -38,14 +38,14 @@ describe('Test jobs', function () {
}) })
it('Should list jobs', async 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.total).to.be.above(2)
expect(body.data).to.have.length.above(2) expect(body.data).to.have.length.above(2)
}) })
it('Should list jobs with sort, pagination and job type', async function () { 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', state: 'completed',
start: 1, start: 1,
count: 2, 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', state: 'completed',
start: 0, start: 0,
count: 100, count: 100,
@ -82,7 +82,7 @@ describe('Test jobs', function () {
}) })
it('Should list all jobs', async 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) expect(body.total).to.be.above(2)
const jobs = body.data const jobs = body.data

View File

@ -693,7 +693,7 @@ describe('Test video transcoding', function () {
describe('Transcoding job queue', function () { describe('Transcoding job queue', function () {
it('Should have the appropriate priorities for transcoding jobs', async 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, start: 0,
count: 100, count: 100,
sort: '-createdAt', sort: '-createdAt',

View File

@ -8,14 +8,14 @@ export class JobsCommand extends AbstractCommand {
async getLatest (options: OverrideCommandOptions & { async getLatest (options: OverrideCommandOptions & {
jobType: JobType 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 if (data.length === 0) return undefined
return data[0] return data[0]
} }
getJobsList (options: OverrideCommandOptions & { list (options: OverrideCommandOptions & {
state?: JobState state?: JobState
jobType?: JobType jobType?: JobType
start?: number start?: number

View File

@ -25,7 +25,7 @@ async function waitJobs (serversArg: PeerTubeServer[] | PeerTubeServer, skipDela
// Check if each server has pending request // Check if each server has pending request
for (const server of servers) { for (const server of servers) {
for (const state of states) { for (const state of states) {
const p = server.jobs.getJobsList({ const p = server.jobs.list({
state, state,
start: 0, start: 0,
count: 10, count: 10,