aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers
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/job-queue/handlers
parent94bb740b49c9991c331b36f1ea29a283ffdba18d (diff)
downloadPeerTube-9a3db678f56eda37d222cf2d2232ae0ef5d533d2.tar.gz
PeerTube-9a3db678f56eda37d222cf2d2232ae0ef5d533d2.tar.zst
PeerTube-9a3db678f56eda37d222cf2d2232ae0ef5d533d2.zip
Fix import video file lock
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r--server/lib/job-queue/handlers/transcoding-job-builder.ts3
-rw-r--r--server/lib/job-queue/handlers/video-import.ts7
-rw-r--r--server/lib/job-queue/handlers/video-studio-edition.ts2
3 files changed, 7 insertions, 5 deletions
diff --git a/server/lib/job-queue/handlers/transcoding-job-builder.ts b/server/lib/job-queue/handlers/transcoding-job-builder.ts
index cb45337df..8621b109f 100644
--- a/server/lib/job-queue/handlers/transcoding-job-builder.ts
+++ b/server/lib/job-queue/handlers/transcoding-job-builder.ts
@@ -23,7 +23,8 @@ async function processTranscodingJobBuilder (job: Job) {
23 23
24 video, 24 video,
25 videoFile, 25 videoFile,
26 user 26 user,
27 videoFileAlreadyLocked: false
27 }) 28 })
28 } 29 }
29 30
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts
index 2a063282c..cdd362f6e 100644
--- a/server/lib/job-queue/handlers/video-import.ts
+++ b/server/lib/job-queue/handlers/video-import.ts
@@ -242,7 +242,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: MVid
242 }) 242 })
243 }) 243 })
244 244
245 await afterImportSuccess({ videoImport: videoImportUpdated, video, videoFile, user: videoImport.User }) 245 await afterImportSuccess({ videoImport: videoImportUpdated, video, videoFile, user: videoImport.User, videoFileAlreadyLocked: true })
246 } finally { 246 } finally {
247 videoFileLockReleaser() 247 videoFileLockReleaser()
248 } 248 }
@@ -292,8 +292,9 @@ async function afterImportSuccess (options: {
292 video: MVideoFullLight 292 video: MVideoFullLight
293 videoFile: MVideoFile 293 videoFile: MVideoFile
294 user: MUserId 294 user: MUserId
295 videoFileAlreadyLocked: boolean
295}) { 296}) {
296 const { video, videoFile, videoImport, user } = options 297 const { video, videoFile, videoImport, user, videoFileAlreadyLocked } = options
297 298
298 Notifier.Instance.notifyOnFinishedVideoImport({ videoImport: Object.assign(videoImport, { Video: video }), success: true }) 299 Notifier.Instance.notifyOnFinishedVideoImport({ videoImport: Object.assign(videoImport, { Video: video }), success: true })
299 300
@@ -313,7 +314,7 @@ async function afterImportSuccess (options: {
313 } 314 }
314 315
315 if (video.state === VideoState.TO_TRANSCODE) { // Create transcoding jobs? 316 if (video.state === VideoState.TO_TRANSCODE) { // Create transcoding jobs?
316 await createOptimizeOrMergeAudioJobs({ video, videoFile, isNewVideo: true, user }) 317 await createOptimizeOrMergeAudioJobs({ video, videoFile, isNewVideo: true, user, videoFileAlreadyLocked })
317 } 318 }
318} 319}
319 320
diff --git a/server/lib/job-queue/handlers/video-studio-edition.ts b/server/lib/job-queue/handlers/video-studio-edition.ts
index 991d11ef1..fbb55a388 100644
--- a/server/lib/job-queue/handlers/video-studio-edition.ts
+++ b/server/lib/job-queue/handlers/video-studio-edition.ts
@@ -95,7 +95,7 @@ async function processVideoStudioEdition (job: Job) {
95 95
96 const user = await UserModel.loadByVideoId(video.id) 96 const user = await UserModel.loadByVideoId(video.id)
97 97
98 await createOptimizeOrMergeAudioJobs({ video, videoFile: newFile, isNewVideo: false, user }) 98 await createOptimizeOrMergeAudioJobs({ video, videoFile: newFile, isNewVideo: false, user, videoFileAlreadyLocked: false })
99} 99}
100 100
101// --------------------------------------------------------------------------- 101// ---------------------------------------------------------------------------