diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/job-queue/handlers/manage-video-torrent.ts | 4 | ||||
-rw-r--r-- | server/tests/api/check-params/video-editor.ts | 5 | ||||
-rw-r--r-- | server/tests/api/server/jobs.ts | 9 |
3 files changed, 13 insertions, 5 deletions
diff --git a/server/lib/job-queue/handlers/manage-video-torrent.ts b/server/lib/job-queue/handlers/manage-video-torrent.ts index 5cb4287e1..dfd4e6140 100644 --- a/server/lib/job-queue/handlers/manage-video-torrent.ts +++ b/server/lib/job-queue/handlers/manage-video-torrent.ts | |||
@@ -28,6 +28,8 @@ async function doCreateAction (payload: ManageVideoTorrentPayload & { action: 'c | |||
28 | loadFileOrLog(payload.videoFileId) | 28 | loadFileOrLog(payload.videoFileId) |
29 | ]) | 29 | ]) |
30 | 30 | ||
31 | if (!video || !file) return | ||
32 | |||
31 | await createTorrentAndSetInfoHash(video, file) | 33 | await createTorrentAndSetInfoHash(video, file) |
32 | 34 | ||
33 | // Refresh videoFile because the createTorrentAndSetInfoHash could be long | 35 | // Refresh videoFile because the createTorrentAndSetInfoHash could be long |
@@ -48,6 +50,8 @@ async function doUpdateMetadataAction (payload: ManageVideoTorrentPayload & { ac | |||
48 | loadFileOrLog(payload.videoFileId) | 50 | loadFileOrLog(payload.videoFileId) |
49 | ]) | 51 | ]) |
50 | 52 | ||
53 | if ((!video && !streamingPlaylist) || !file) return | ||
54 | |||
51 | await updateTorrentMetadata(video || streamingPlaylist, file) | 55 | await updateTorrentMetadata(video || streamingPlaylist, file) |
52 | 56 | ||
53 | await file.save() | 57 | await file.save() |
diff --git a/server/tests/api/check-params/video-editor.ts b/server/tests/api/check-params/video-editor.ts index db284a3cc..1fd22c497 100644 --- a/server/tests/api/check-params/video-editor.ts +++ b/server/tests/api/check-params/video-editor.ts | |||
@@ -122,10 +122,11 @@ describe('Test video editor API validator', function () { | |||
122 | }) | 122 | }) |
123 | 123 | ||
124 | it('Should fail with an already in transcoding state video', async function () { | 124 | it('Should fail with an already in transcoding state video', async function () { |
125 | await server.jobs.pauseJobQueue() | ||
126 | |||
127 | const { uuid } = await server.videos.quickUpload({ name: 'transcoded video' }) | 125 | const { uuid } = await server.videos.quickUpload({ name: 'transcoded video' }) |
128 | 126 | ||
127 | await server.jobs.pauseJobQueue() | ||
128 | await server.videos.runTranscoding({ videoId: uuid, transcodingType: 'hls' }) | ||
129 | |||
129 | await command.createEditionTasks({ | 130 | await command.createEditionTasks({ |
130 | videoId: uuid, | 131 | videoId: uuid, |
131 | tasks: VideoEditorCommand.getComplexTask(), | 132 | tasks: VideoEditorCommand.getComplexTask(), |
diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts index bd8ffe188..6cc88a123 100644 --- a/server/tests/api/server/jobs.ts +++ b/server/tests/api/server/jobs.ts | |||
@@ -12,6 +12,7 @@ import { | |||
12 | waitJobs | 12 | waitJobs |
13 | } from '@shared/server-commands' | 13 | } from '@shared/server-commands' |
14 | import { wait } from '@shared/core-utils' | 14 | import { wait } from '@shared/core-utils' |
15 | import { uuid } from 'short-uuid' | ||
15 | 16 | ||
16 | const expect = chai.expect | 17 | const expect = chai.expect |
17 | 18 | ||
@@ -95,14 +96,16 @@ describe('Test jobs', function () { | |||
95 | it('Should pause the job queue', async function () { | 96 | it('Should pause the job queue', async function () { |
96 | this.timeout(120000) | 97 | this.timeout(120000) |
97 | 98 | ||
98 | await servers[1].jobs.pauseJobQueue() | 99 | const { uuid } = await servers[1].videos.upload({ attributes: { name: 'video2' } }) |
100 | await waitJobs(servers) | ||
99 | 101 | ||
100 | await servers[1].videos.upload({ attributes: { name: 'video2' } }) | 102 | await servers[1].jobs.pauseJobQueue() |
103 | await servers[1].videos.runTranscoding({ videoId: uuid, transcodingType: 'hls' }) | ||
101 | 104 | ||
102 | await wait(5000) | 105 | await wait(5000) |
103 | 106 | ||
104 | const body = await servers[1].jobs.list({ state: 'waiting', jobType: 'video-transcoding' }) | 107 | const body = await servers[1].jobs.list({ state: 'waiting', jobType: 'video-transcoding' }) |
105 | expect(body.data).to.have.lengthOf(1) | 108 | expect(body.data).to.have.lengthOf(4) |
106 | }) | 109 | }) |
107 | 110 | ||
108 | it('Should resume the job queue', async function () { | 111 | it('Should resume the job queue', async function () { |