aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-05 13:41:48 +0200
committerChocobozzz <chocobozzz@cpy.re>2023-05-09 08:57:34 +0200
commita687879e94fa5d3ecdd76bec3d94d0e1698ee913 (patch)
treeb17ee096918dfd4624d50dbf0e91ff8f66bd4a7f /server/lib/job-queue
parente7d8e2b245491c0a8e008fb570037506d729ff04 (diff)
downloadPeerTube-a687879e94fa5d3ecdd76bec3d94d0e1698ee913.tar.gz
PeerTube-a687879e94fa5d3ecdd76bec3d94d0e1698ee913.tar.zst
PeerTube-a687879e94fa5d3ecdd76bec3d94d0e1698ee913.zip
Reload the video after waiting for the files lock
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r--server/lib/job-queue/handlers/manage-video-torrent.ts3
-rw-r--r--server/lib/job-queue/handlers/move-to-object-storage.ts5
-rw-r--r--server/lib/job-queue/handlers/video-live-ending.ts1
3 files changed, 7 insertions, 2 deletions
diff --git a/server/lib/job-queue/handlers/manage-video-torrent.ts b/server/lib/job-queue/handlers/manage-video-torrent.ts
index cef93afda..edf52de0c 100644
--- a/server/lib/job-queue/handlers/manage-video-torrent.ts
+++ b/server/lib/job-queue/handlers/manage-video-torrent.ts
@@ -35,6 +35,9 @@ async function doCreateAction (payload: ManageVideoTorrentPayload & { action: 'c
35 const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) 35 const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
36 36
37 try { 37 try {
38 await video.reload()
39 await file.reload()
40
38 await createTorrentAndSetInfoHash(video, file) 41 await createTorrentAndSetInfoHash(video, file)
39 42
40 // Refresh videoFile because the createTorrentAndSetInfoHash could be long 43 // Refresh videoFile because the createTorrentAndSetInfoHash could be long
diff --git a/server/lib/job-queue/handlers/move-to-object-storage.ts b/server/lib/job-queue/handlers/move-to-object-storage.ts
index a1530cc57..26752ff37 100644
--- a/server/lib/job-queue/handlers/move-to-object-storage.ts
+++ b/server/lib/job-queue/handlers/move-to-object-storage.ts
@@ -19,17 +19,18 @@ export async function processMoveToObjectStorage (job: Job) {
19 const payload = job.data as MoveObjectStoragePayload 19 const payload = job.data as MoveObjectStoragePayload
20 logger.info('Moving video %s in job %s.', payload.videoUUID, job.id) 20 logger.info('Moving video %s in job %s.', payload.videoUUID, job.id)
21 21
22 const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(payload.videoUUID)
23
22 const video = await VideoModel.loadWithFiles(payload.videoUUID) 24 const video = await VideoModel.loadWithFiles(payload.videoUUID)
23 // No video, maybe deleted? 25 // No video, maybe deleted?
24 if (!video) { 26 if (!video) {
25 logger.info('Can\'t process job %d, video does not exist.', job.id, lTagsBase(payload.videoUUID)) 27 logger.info('Can\'t process job %d, video does not exist.', job.id, lTagsBase(payload.videoUUID))
28 fileMutexReleaser()
26 return undefined 29 return undefined
27 } 30 }
28 31
29 const lTags = lTagsBase(video.uuid, video.url) 32 const lTags = lTagsBase(video.uuid, video.url)
30 33
31 const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
32
33 try { 34 try {
34 if (video.VideoFiles) { 35 if (video.VideoFiles) {
35 logger.debug('Moving %d webtorrent files for video %s.', video.VideoFiles.length, video.uuid, lTags) 36 logger.debug('Moving %d webtorrent files for video %s.', video.VideoFiles.length, video.uuid, lTags)
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts
index 1bf43f592..814f313a3 100644
--- a/server/lib/job-queue/handlers/video-live-ending.ts
+++ b/server/lib/job-queue/handlers/video-live-ending.ts
@@ -218,6 +218,7 @@ async function assignReplayFilesToVideo (options: {
218 218
219 for (const concatenatedTsFile of concatenatedTsFiles) { 219 for (const concatenatedTsFile of concatenatedTsFiles) {
220 const inputFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) 220 const inputFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
221 await video.reload()
221 222
222 const concatenatedTsFilePath = join(replayDirectory, concatenatedTsFile) 223 const concatenatedTsFilePath = join(replayDirectory, concatenatedTsFile)
223 224