aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r--server/lib/job-queue/handlers/video-file.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/server/lib/job-queue/handlers/video-file.ts b/server/lib/job-queue/handlers/video-file.ts
index a5c6bf300..fc40527c7 100644
--- a/server/lib/job-queue/handlers/video-file.ts
+++ b/server/lib/job-queue/handlers/video-file.ts
@@ -71,13 +71,18 @@ async function onVideoFileTranscoderOrImportSuccess (video: VideoModel) {
71 // Video does not exist anymore 71 // Video does not exist anymore
72 if (!videoDatabase) return undefined 72 if (!videoDatabase) return undefined
73 73
74 let isNewVideo = false
75
74 // We transcoded the video file in another format, now we can publish it 76 // We transcoded the video file in another format, now we can publish it
75 const oldState = videoDatabase.state 77 if (videoDatabase.state !== VideoState.PUBLISHED) {
76 videoDatabase.state = VideoState.PUBLISHED 78 isNewVideo = true
77 videoDatabase = await videoDatabase.save({ transaction: t }) 79
80 videoDatabase.state = VideoState.PUBLISHED
81 videoDatabase.publishedAt = new Date()
82 videoDatabase = await videoDatabase.save({ transaction: t })
83 }
78 84
79 // If the video was not published, we consider it is a new one for other instances 85 // If the video was not published, we consider it is a new one for other instances
80 const isNewVideo = oldState !== VideoState.PUBLISHED
81 await federateVideoIfNeeded(videoDatabase, isNewVideo, t) 86 await federateVideoIfNeeded(videoDatabase, isNewVideo, t)
82 87
83 return undefined 88 return undefined