X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Flib%2Fjobs%2Fhandlers%2Fvideo-file-transcoder.ts;h=b240ff58af52def8faa5aaa4ae9b28f2d4ce68cc;hb=f5028693a896a3076dd286ac0030e3d8f78f5ebf;hp=0dafee566a08639cfb65f4d86d26853fb68bcd35;hpb=eb08047657e739bcd9e592d76307befa3998482b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/jobs/handlers/video-file-transcoder.ts b/server/lib/jobs/handlers/video-file-transcoder.ts index 0dafee566..b240ff58a 100644 --- a/server/lib/jobs/handlers/video-file-transcoder.ts +++ b/server/lib/jobs/handlers/video-file-transcoder.ts @@ -4,16 +4,17 @@ import { logger } from '../../../helpers' import { VideoInstance } from '../../../models' import { VideoResolution } from '../../../../shared' -function process (data: { videoUUID: string, resolution: VideoResolution }, jobId: number) { - return db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(data.videoUUID).then(video => { - // No video, maybe deleted? - if (!video) { - logger.info('Do not process job %d, video does not exist.', jobId, { videoUUID: video.uuid }) - return undefined - } - - return video.transcodeOriginalVideofile(data.resolution).then(() => video) - }) +async function process (data: { videoUUID: string, resolution: VideoResolution }, jobId: number) { + const video = await db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(data.videoUUID) + // No video, maybe deleted? + if (!video) { + logger.info('Do not process job %d, video does not exist.', jobId, { videoUUID: video.uuid }) + return undefined + } + + await video.transcodeOriginalVideofile(data.resolution) + + return video } function onError (err: Error, jobId: number) {