1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 11:59:58 +02:00

Fix integrity with transcoding jobs

This commit is contained in:
Chocobozzz 2017-10-26 14:22:37 +02:00
parent 911238e343
commit 4077df72c6
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 20 additions and 8 deletions

View file

@ -22,15 +22,22 @@ function onError (err: Error, jobId: number) {
return Promise.resolve()
}
function onSuccess (jobId: number, video: VideoInstance) {
async function onSuccess (jobId: number, video: VideoInstance) {
if (video === undefined) return undefined
logger.info('Job %d is a success.', jobId)
const remoteVideo = video.toUpdateRemoteJSON()
// Maybe the video changed in database, refresh it
const videoDatabase = await db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(video.uuid)
// Video does not exist anymore
if (!videoDatabase) return undefined
const remoteVideo = videoDatabase.toUpdateRemoteJSON()
// Now we'll add the video's meta data to our friends
return updateVideoToFriends(remoteVideo, null)
await updateVideoToFriends(remoteVideo, null)
return
}
// ---------------------------------------------------------------------------