aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers/video-import.ts
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/video-import.ts
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/video-import.ts')
-rw-r--r--server/lib/job-queue/handlers/video-import.ts7
1 files changed, 4 insertions, 3 deletions
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