1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Reload the video after waiting for the files lock

This commit is contained in:
Chocobozzz 2023-05-05 13:41:48 +02:00 committed by Chocobozzz
parent e7d8e2b245
commit a687879e94
10 changed files with 27 additions and 11 deletions

View file

@ -19,17 +19,18 @@ export async function processMoveToObjectStorage (job: Job) {
const payload = job.data as MoveObjectStoragePayload
logger.info('Moving video %s in job %s.', payload.videoUUID, job.id)
const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(payload.videoUUID)
const video = await VideoModel.loadWithFiles(payload.videoUUID)
// No video, maybe deleted?
if (!video) {
logger.info('Can\'t process job %d, video does not exist.', job.id, lTagsBase(payload.videoUUID))
fileMutexReleaser()
return undefined
}
const lTags = lTagsBase(video.uuid, video.url)
const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
try {
if (video.VideoFiles) {
logger.debug('Moving %d webtorrent files for video %s.', video.VideoFiles.length, video.uuid, lTags)