video,
videoFile,
- user
+ user,
+ videoFileAlreadyLocked: false
})
}
})
})
- await afterImportSuccess({ videoImport: videoImportUpdated, video, videoFile, user: videoImport.User })
+ await afterImportSuccess({ videoImport: videoImportUpdated, video, videoFile, user: videoImport.User, videoFileAlreadyLocked: true })
} finally {
videoFileLockReleaser()
}
video: MVideoFullLight
videoFile: MVideoFile
user: MUserId
+ videoFileAlreadyLocked: boolean
}) {
- const { video, videoFile, videoImport, user } = options
+ const { video, videoFile, videoImport, user, videoFileAlreadyLocked } = options
Notifier.Instance.notifyOnFinishedVideoImport({ videoImport: Object.assign(videoImport, { Video: video }), success: true })
}
if (video.state === VideoState.TO_TRANSCODE) { // Create transcoding jobs?
- await createOptimizeOrMergeAudioJobs({ video, videoFile, isNewVideo: true, user })
+ await createOptimizeOrMergeAudioJobs({ video, videoFile, isNewVideo: true, user, videoFileAlreadyLocked })
}
}
const user = await UserModel.loadByVideoId(video.id)
- await createOptimizeOrMergeAudioJobs({ video, videoFile: newFile, isNewVideo: false, user })
+ await createOptimizeOrMergeAudioJobs({ video, videoFile: newFile, isNewVideo: false, user, videoFileAlreadyLocked: false })
}
// ---------------------------------------------------------------------------
videoFile: MVideoFile
isNewVideo: boolean
user: MUserId
+ videoFileAlreadyLocked: boolean
}) {
return getJobBuilder().createOptimizeOrMergeAudioJobs(options)
}
videoFile: MVideoFile
isNewVideo: boolean
user: MUserId
+ videoFileAlreadyLocked: boolean
}): Promise<any>
abstract createTranscodingJobs (options: {
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 => {
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 => {