aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/transcoding
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-02 13:38:00 +0200
committerChocobozzz <chocobozzz@cpy.re>2023-05-09 08:57:34 +0200
commit9a3db678f56eda37d222cf2d2232ae0ef5d533d2 (patch)
tree69dfaedcba0c7212efcfadcfc308761b2d4bab87 /server/lib/transcoding
parent94bb740b49c9991c331b36f1ea29a283ffdba18d (diff)
downloadPeerTube-9a3db678f56eda37d222cf2d2232ae0ef5d533d2.tar.gz
PeerTube-9a3db678f56eda37d222cf2d2232ae0ef5d533d2.tar.zst
PeerTube-9a3db678f56eda37d222cf2d2232ae0ef5d533d2.zip
Fix import video file lock
Diffstat (limited to 'server/lib/transcoding')
-rw-r--r--server/lib/transcoding/create-transcoding-job.ts1
-rw-r--r--server/lib/transcoding/shared/job-builders/abstract-job-builder.ts1
-rw-r--r--server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts7
-rw-r--r--server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts7
4 files changed, 12 insertions, 4 deletions
diff --git a/server/lib/transcoding/create-transcoding-job.ts b/server/lib/transcoding/create-transcoding-job.ts
index 46831a912..abe32684d 100644
--- a/server/lib/transcoding/create-transcoding-job.ts
+++ b/server/lib/transcoding/create-transcoding-job.ts
@@ -7,6 +7,7 @@ export function createOptimizeOrMergeAudioJobs (options: {
7 videoFile: MVideoFile 7 videoFile: MVideoFile
8 isNewVideo: boolean 8 isNewVideo: boolean
9 user: MUserId 9 user: MUserId
10 videoFileAlreadyLocked: boolean
10}) { 11}) {
11 return getJobBuilder().createOptimizeOrMergeAudioJobs(options) 12 return getJobBuilder().createOptimizeOrMergeAudioJobs(options)
12} 13}
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 {
10 videoFile: MVideoFile 10 videoFile: MVideoFile
11 isNewVideo: boolean 11 isNewVideo: boolean
12 user: MUserId 12 user: MUserId
13 videoFileAlreadyLocked: boolean
13 }): Promise<any> 14 }): Promise<any>
14 15
15 abstract createTranscodingJobs (options: { 16 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 {
27 videoFile: MVideoFile 27 videoFile: MVideoFile
28 isNewVideo: boolean 28 isNewVideo: boolean
29 user: MUserId 29 user: MUserId
30 videoFileAlreadyLocked: boolean
30 }) { 31 }) {
31 const { video, videoFile, isNewVideo, user } = options 32 const { video, videoFile, isNewVideo, user, videoFileAlreadyLocked } = options
32 33
33 let mergeOrOptimizePayload: MergeAudioTranscodingPayload | OptimizeTranscodingPayload 34 let mergeOrOptimizePayload: MergeAudioTranscodingPayload | OptimizeTranscodingPayload
34 let nextTranscodingSequentialJobPayloads: (NewWebTorrentResolutionTranscodingPayload | HLSTranscodingPayload)[][] = [] 35 let nextTranscodingSequentialJobPayloads: (NewWebTorrentResolutionTranscodingPayload | HLSTranscodingPayload)[][] = []
35 36
36 const mutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) 37 const mutexReleaser = videoFileAlreadyLocked
38 ? () => {}
39 : await VideoPathManager.Instance.lockFiles(video.uuid)
37 40
38 try { 41 try {
39 await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => { 42 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 {
26 videoFile: MVideoFile 26 videoFile: MVideoFile
27 isNewVideo: boolean 27 isNewVideo: boolean
28 user: MUserId 28 user: MUserId
29 videoFileAlreadyLocked: boolean
29 }) { 30 }) {
30 const { video, videoFile, isNewVideo, user } = options 31 const { video, videoFile, isNewVideo, user, videoFileAlreadyLocked } = options
31 32
32 const mutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) 33 const mutexReleaser = videoFileAlreadyLocked
34 ? () => {}
35 : await VideoPathManager.Instance.lockFiles(video.uuid)
33 36
34 try { 37 try {
35 await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => { 38 await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => {