aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers/move-to-object-storage.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-22 14:35:04 +0100
committerChocobozzz <me@florianbigard.com>2022-03-22 16:25:14 +0100
commit1808a1f8e4b7b102823492a2007a46929aebf189 (patch)
treea345140ec9a7a20c222ace3cda18ac999277c8c3 /server/lib/job-queue/handlers/move-to-object-storage.ts
parent348c2ce3ff3fe2f25a31f08bfb36c88723a0ce46 (diff)
downloadPeerTube-1808a1f8e4b7b102823492a2007a46929aebf189.tar.gz
PeerTube-1808a1f8e4b7b102823492a2007a46929aebf189.tar.zst
PeerTube-1808a1f8e4b7b102823492a2007a46929aebf189.zip
Add video edition finished notification
Diffstat (limited to 'server/lib/job-queue/handlers/move-to-object-storage.ts')
-rw-r--r--server/lib/job-queue/handlers/move-to-object-storage.ts14
1 files changed, 10 insertions, 4 deletions
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 69b441176..f480b32cd 100644
--- a/server/lib/job-queue/handlers/move-to-object-storage.ts
+++ b/server/lib/job-queue/handlers/move-to-object-storage.ts
@@ -11,7 +11,7 @@ import { moveToFailedMoveToObjectStorageState, moveToNextState } from '@server/l
11import { VideoModel } from '@server/models/video/video' 11import { VideoModel } from '@server/models/video/video'
12import { VideoJobInfoModel } from '@server/models/video/video-job-info' 12import { VideoJobInfoModel } from '@server/models/video/video-job-info'
13import { MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoWithAllFiles } from '@server/types/models' 13import { MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoWithAllFiles } from '@server/types/models'
14import { MoveObjectStoragePayload, VideoStorage } from '@shared/models' 14import { MoveObjectStoragePayload, VideoState, VideoStorage } from '@shared/models'
15 15
16const lTagsBase = loggerTagsFactory('move-object-storage') 16const lTagsBase = loggerTagsFactory('move-object-storage')
17 17
@@ -45,7 +45,7 @@ export async function processMoveToObjectStorage (job: Job) {
45 if (pendingMove === 0) { 45 if (pendingMove === 0) {
46 logger.info('Running cleanup after moving files to object storage (video %s in job %d)', video.uuid, job.id, lTags) 46 logger.info('Running cleanup after moving files to object storage (video %s in job %d)', video.uuid, job.id, lTags)
47 47
48 await doAfterLastJob(video, payload.isNewVideo) 48 await doAfterLastJob({ video, previousVideoState: payload.previousVideoState, isNewVideo: payload.isNewVideo })
49 } 49 }
50 } catch (err) { 50 } catch (err) {
51 logger.error('Cannot move video %s to object storage.', video.url, { err, ...lTags }) 51 logger.error('Cannot move video %s to object storage.', video.url, { err, ...lTags })
@@ -91,7 +91,13 @@ async function moveHLSFiles (video: MVideoWithAllFiles) {
91 } 91 }
92} 92}
93 93
94async function doAfterLastJob (video: MVideoWithAllFiles, isNewVideo: boolean) { 94async function doAfterLastJob (options: {
95 video: MVideoWithAllFiles
96 previousVideoState: VideoState
97 isNewVideo: boolean
98}) {
99 const { video, previousVideoState, isNewVideo } = options
100
95 for (const playlist of video.VideoStreamingPlaylists) { 101 for (const playlist of video.VideoStreamingPlaylists) {
96 if (playlist.storage === VideoStorage.OBJECT_STORAGE) continue 102 if (playlist.storage === VideoStorage.OBJECT_STORAGE) continue
97 103
@@ -115,7 +121,7 @@ async function doAfterLastJob (video: MVideoWithAllFiles, isNewVideo: boolean) {
115 await remove(getHLSDirectory(video)) 121 await remove(getHLSDirectory(video))
116 } 122 }
117 123
118 await moveToNextState(video, isNewVideo) 124 await moveToNextState({ video, previousVideoState, isNewVideo })
119} 125}
120 126
121async function onFileMoved (options: { 127async function onFileMoved (options: {