From fe7019b2323768f7e33890303f95c9a45688ac1d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 19 May 2023 09:23:20 +0200 Subject: Fix peertube runner concurrency --- server/controllers/api/runners/jobs.ts | 2 ++ .../live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts | 4 ++++ server/tests/api/server/open-telemetry.ts | 6 +++--- server/tests/peertube-runner/vod-transcoding.ts | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) (limited to 'server') 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 { RunnerJobType, RunnerJobUpdateBody, RunnerJobUpdatePayload, + ServerErrorCode, UserRight, VideoStudioTranscodingSuccess, VODAudioMergeTranscodingSuccess, @@ -168,6 +169,7 @@ async function acceptRunnerJob (req: express.Request, res: express.Response) { if (runnerJob.state !== RunnerJobState.PENDING) { res.fail({ + type: ServerErrorCode.RUNNER_JOB_NOT_IN_PENDING_STATE, message: 'This job is not in pending state anymore', status: HttpStatusCode.CONFLICT_409 }) 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 { abort () { if (this.ended || this.errored || this.aborted) return + logger.debug('Killing ffmpeg after live abort of ' + this.videoUUID, this.lTags()) + this.ffmpegCommand.kill('SIGINT') this.aborted = true @@ -95,6 +97,8 @@ export class FFmpegTranscodingWrapper extends AbstractTranscodingWrapper { private onFFmpegEnded () { if (this.ended || this.errored || this.aborted) return + logger.debug('Live ffmpeg transcoding ended for ' + this.videoUUID, this.lTags()) + this.ended = true this.emit('end') } 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 () { it('Should enable open telemetry metrics', async function () { this.timeout(120000) - server = await createSingleServer(1, { + await server.run({ open_telemetry: { metrics: { enabled: true @@ -73,7 +73,7 @@ describe('Open Telemetry', function () { it('Should disable http request duration metrics', async function () { await server.kill() - server = await createSingleServer(1, { + await server.run({ open_telemetry: { metrics: { enabled: true, @@ -114,7 +114,7 @@ describe('Open Telemetry', function () { }) it('Should enable open telemetry metrics', async function () { - server = await createSingleServer(1, { + await server.run({ open_telemetry: { tracing: { 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 () { }) it('Should transcode videos on manual run', async function () { - this.timeout(120000) + this.timeout(240000) await servers[0].config.disableTranscoding() -- cgit v1.2.3