From 9a3db678f56eda37d222cf2d2232ae0ef5d533d2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 2 May 2023 13:38:00 +0200 Subject: Fix import video file lock --- server/lib/transcoding/shared/job-builders/abstract-job-builder.ts | 1 + .../shared/job-builders/transcoding-job-queue-builder.ts | 7 +++++-- .../shared/job-builders/transcoding-runner-job-builder.ts | 7 +++++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'server/lib/transcoding/shared') diff --git a/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts b/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts index f1e9efdcf..576e786d5 100644 --- a/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts +++ b/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts @@ -10,6 +10,7 @@ export abstract class AbstractJobBuilder { videoFile: MVideoFile isNewVideo: boolean user: MUserId + videoFileAlreadyLocked: boolean }): Promise abstract createTranscodingJobs (options: { diff --git a/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts b/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts index c09c6b8ce..5a9c93ee5 100644 --- a/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts +++ b/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts @@ -27,13 +27,16 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder { videoFile: MVideoFile isNewVideo: boolean user: MUserId + videoFileAlreadyLocked: boolean }) { - const { video, videoFile, isNewVideo, user } = options + const { video, videoFile, isNewVideo, user, videoFileAlreadyLocked } = options let mergeOrOptimizePayload: MergeAudioTranscodingPayload | OptimizeTranscodingPayload let nextTranscodingSequentialJobPayloads: (NewWebTorrentResolutionTranscodingPayload | HLSTranscodingPayload)[][] = [] - const mutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) + const mutexReleaser = videoFileAlreadyLocked + ? () => {} + : await VideoPathManager.Instance.lockFiles(video.uuid) try { await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => { diff --git a/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts b/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts index c7a63d2e2..274dce21b 100644 --- a/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts +++ b/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts @@ -26,10 +26,13 @@ export class TranscodingRunnerJobBuilder extends AbstractJobBuilder { videoFile: MVideoFile isNewVideo: boolean user: MUserId + videoFileAlreadyLocked: boolean }) { - const { video, videoFile, isNewVideo, user } = options + const { video, videoFile, isNewVideo, user, videoFileAlreadyLocked } = options - const mutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) + const mutexReleaser = videoFileAlreadyLocked + ? () => {} + : await VideoPathManager.Instance.lockFiles(video.uuid) try { await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => { -- cgit v1.2.3