From c1e791bad0b079af67398f6407221e6dcbb573dd Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Wed, 25 Jul 2018 22:01:25 +0200 Subject: expliciting type checks and predicates (server only) --- server/lib/job-queue/handlers/utils/activitypub-http-utils.ts | 2 +- server/lib/job-queue/handlers/video-file.ts | 6 +++--- server/lib/job-queue/job-queue.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'server/lib/job-queue') diff --git a/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts b/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts index c087371c6..36092665e 100644 --- a/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts +++ b/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts @@ -15,7 +15,7 @@ async function computeBody (payload: { body: any, signatureActorId?: number }) { } async function buildSignedRequestOptions (payload: { signatureActorId?: number }) { - let actor: ActorModel + let actor: ActorModel | null if (payload.signatureActorId) { actor = await ActorModel.load(payload.signatureActorId) if (!actor) throw new Error('Unknown signature actor id.') diff --git a/server/lib/job-queue/handlers/video-file.ts b/server/lib/job-queue/handlers/video-file.ts index bd68dd78b..6b1a8f132 100644 --- a/server/lib/job-queue/handlers/video-file.ts +++ b/server/lib/job-queue/handlers/video-file.ts @@ -28,7 +28,7 @@ async function processVideoFileImport (job: Bull.Job) { const video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(payload.videoUUID) // No video, maybe deleted? if (!video) { - logger.info('Do not process job %d, video does not exist.', job.id, { videoUUID: video.uuid }) + logger.info('Do not process job %d, video does not exist.', job.id) return undefined } @@ -45,13 +45,13 @@ async function processVideoFile (job: Bull.Job) { const video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(payload.videoUUID) // No video, maybe deleted? if (!video) { - logger.info('Do not process job %d, video does not exist.', job.id, { videoUUID: video.uuid }) + logger.info('Do not process job %d, video does not exist.', job.id) return undefined } // Transcoding in other resolution if (payload.resolution) { - await video.transcodeOriginalVideofile(payload.resolution, payload.isPortraitMode) + await video.transcodeOriginalVideofile(payload.resolution, payload.isPortraitMode || false) await retryTransactionWrapper(onVideoFileTranscoderOrImportSuccess, video) } else { diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts index 1b46180e8..b018d0e8a 100644 --- a/server/lib/job-queue/job-queue.ts +++ b/server/lib/job-queue/job-queue.ts @@ -87,7 +87,7 @@ class JobQueue { const queue = this.queues[obj.type] if (queue === undefined) { logger.error('Unknown queue %s: cannot create job.', obj.type) - return + throw Error('Unknown queue, cannot create job') } const jobArgs: Bull.JobOptions = { -- cgit v1.2.3