diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-19 09:23:20 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-19 09:23:20 +0200 |
commit | fe7019b2323768f7e33890303f95c9a45688ac1d (patch) | |
tree | 8ccd4aa71d36626d1bffb1e2a8537241e2002404 /server | |
parent | ef2e6aabf755feeec96011e70ff2522a491c5cb3 (diff) | |
download | PeerTube-fe7019b2323768f7e33890303f95c9a45688ac1d.tar.gz PeerTube-fe7019b2323768f7e33890303f95c9a45688ac1d.tar.zst PeerTube-fe7019b2323768f7e33890303f95c9a45688ac1d.zip |
Fix peertube runner concurrency
Diffstat (limited to 'server')
4 files changed, 10 insertions, 4 deletions
diff --git a/server/controllers/api/runners/jobs.ts b/server/controllers/api/runners/jobs.ts index bdeb0c6cd..140f062be 100644 --- a/server/controllers/api/runners/jobs.ts +++ b/server/controllers/api/runners/jobs.ts | |||
@@ -42,6 +42,7 @@ import { | |||
42 | RunnerJobType, | 42 | RunnerJobType, |
43 | RunnerJobUpdateBody, | 43 | RunnerJobUpdateBody, |
44 | RunnerJobUpdatePayload, | 44 | RunnerJobUpdatePayload, |
45 | ServerErrorCode, | ||
45 | UserRight, | 46 | UserRight, |
46 | VideoStudioTranscodingSuccess, | 47 | VideoStudioTranscodingSuccess, |
47 | VODAudioMergeTranscodingSuccess, | 48 | VODAudioMergeTranscodingSuccess, |
@@ -168,6 +169,7 @@ async function acceptRunnerJob (req: express.Request, res: express.Response) { | |||
168 | 169 | ||
169 | if (runnerJob.state !== RunnerJobState.PENDING) { | 170 | if (runnerJob.state !== RunnerJobState.PENDING) { |
170 | res.fail({ | 171 | res.fail({ |
172 | type: ServerErrorCode.RUNNER_JOB_NOT_IN_PENDING_STATE, | ||
171 | message: 'This job is not in pending state anymore', | 173 | message: 'This job is not in pending state anymore', |
172 | status: HttpStatusCode.CONFLICT_409 | 174 | status: HttpStatusCode.CONFLICT_409 |
173 | }) | 175 | }) |
diff --git a/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts b/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts index 3c2cf51b7..5bad34860 100644 --- a/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts +++ b/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts | |||
@@ -68,6 +68,8 @@ export class FFmpegTranscodingWrapper extends AbstractTranscodingWrapper { | |||
68 | abort () { | 68 | abort () { |
69 | if (this.ended || this.errored || this.aborted) return | 69 | if (this.ended || this.errored || this.aborted) return |
70 | 70 | ||
71 | logger.debug('Killing ffmpeg after live abort of ' + this.videoUUID, this.lTags()) | ||
72 | |||
71 | this.ffmpegCommand.kill('SIGINT') | 73 | this.ffmpegCommand.kill('SIGINT') |
72 | 74 | ||
73 | this.aborted = true | 75 | this.aborted = true |
@@ -95,6 +97,8 @@ export class FFmpegTranscodingWrapper extends AbstractTranscodingWrapper { | |||
95 | private onFFmpegEnded () { | 97 | private onFFmpegEnded () { |
96 | if (this.ended || this.errored || this.aborted) return | 98 | if (this.ended || this.errored || this.aborted) return |
97 | 99 | ||
100 | logger.debug('Live ffmpeg transcoding ended for ' + this.videoUUID, this.lTags()) | ||
101 | |||
98 | this.ended = true | 102 | this.ended = true |
99 | this.emit('end') | 103 | this.emit('end') |
100 | } | 104 | } |
diff --git a/server/tests/api/server/open-telemetry.ts b/server/tests/api/server/open-telemetry.ts index 49f3b520b..fd85fc514 100644 --- a/server/tests/api/server/open-telemetry.ts +++ b/server/tests/api/server/open-telemetry.ts | |||
@@ -31,7 +31,7 @@ describe('Open Telemetry', function () { | |||
31 | it('Should enable open telemetry metrics', async function () { | 31 | it('Should enable open telemetry metrics', async function () { |
32 | this.timeout(120000) | 32 | this.timeout(120000) |
33 | 33 | ||
34 | server = await createSingleServer(1, { | 34 | await server.run({ |
35 | open_telemetry: { | 35 | open_telemetry: { |
36 | metrics: { | 36 | metrics: { |
37 | enabled: true | 37 | enabled: true |
@@ -73,7 +73,7 @@ describe('Open Telemetry', function () { | |||
73 | it('Should disable http request duration metrics', async function () { | 73 | it('Should disable http request duration metrics', async function () { |
74 | await server.kill() | 74 | await server.kill() |
75 | 75 | ||
76 | server = await createSingleServer(1, { | 76 | await server.run({ |
77 | open_telemetry: { | 77 | open_telemetry: { |
78 | metrics: { | 78 | metrics: { |
79 | enabled: true, | 79 | enabled: true, |
@@ -114,7 +114,7 @@ describe('Open Telemetry', function () { | |||
114 | }) | 114 | }) |
115 | 115 | ||
116 | it('Should enable open telemetry metrics', async function () { | 116 | it('Should enable open telemetry metrics', async function () { |
117 | server = await createSingleServer(1, { | 117 | await server.run({ |
118 | open_telemetry: { | 118 | open_telemetry: { |
119 | tracing: { | 119 | tracing: { |
120 | enabled: true, | 120 | enabled: true, |
diff --git a/server/tests/peertube-runner/vod-transcoding.ts b/server/tests/peertube-runner/vod-transcoding.ts index 3c0918102..d7e2df095 100644 --- a/server/tests/peertube-runner/vod-transcoding.ts +++ b/server/tests/peertube-runner/vod-transcoding.ts | |||
@@ -189,7 +189,7 @@ describe('Test VOD transcoding in peertube-runner program', function () { | |||
189 | }) | 189 | }) |
190 | 190 | ||
191 | it('Should transcode videos on manual run', async function () { | 191 | it('Should transcode videos on manual run', async function () { |
192 | this.timeout(120000) | 192 | this.timeout(240000) |
193 | 193 | ||
194 | await servers[0].config.disableTranscoding() | 194 | await servers[0].config.disableTranscoding() |
195 | 195 | ||