aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-07-25 22:01:25 +0200
committerRigel Kent <sendmemail@rigelk.eu>2018-07-25 22:01:25 +0200
commitc1e791bad0b079af67398f6407221e6dcbb573dd (patch)
tree82e5944b4458dd35aa482a38f6b650eb93bb89ad /server/lib/job-queue
parent5f7021c33d31c5255b995ae0ff86b5bbea4ea4b9 (diff)
downloadPeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.tar.gz
PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.tar.zst
PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.zip
expliciting type checks and predicates (server only)
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r--server/lib/job-queue/handlers/utils/activitypub-http-utils.ts2
-rw-r--r--server/lib/job-queue/handlers/video-file.ts6
-rw-r--r--server/lib/job-queue/job-queue.ts2
3 files changed, 5 insertions, 5 deletions
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 }) {
15} 15}
16 16
17async function buildSignedRequestOptions (payload: { signatureActorId?: number }) { 17async function buildSignedRequestOptions (payload: { signatureActorId?: number }) {
18 let actor: ActorModel 18 let actor: ActorModel | null
19 if (payload.signatureActorId) { 19 if (payload.signatureActorId) {
20 actor = await ActorModel.load(payload.signatureActorId) 20 actor = await ActorModel.load(payload.signatureActorId)
21 if (!actor) throw new Error('Unknown signature actor id.') 21 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) {
28 const video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(payload.videoUUID) 28 const video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(payload.videoUUID)
29 // No video, maybe deleted? 29 // No video, maybe deleted?
30 if (!video) { 30 if (!video) {
31 logger.info('Do not process job %d, video does not exist.', job.id, { videoUUID: video.uuid }) 31 logger.info('Do not process job %d, video does not exist.', job.id)
32 return undefined 32 return undefined
33 } 33 }
34 34
@@ -45,13 +45,13 @@ async function processVideoFile (job: Bull.Job) {
45 const video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(payload.videoUUID) 45 const video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(payload.videoUUID)
46 // No video, maybe deleted? 46 // No video, maybe deleted?
47 if (!video) { 47 if (!video) {
48 logger.info('Do not process job %d, video does not exist.', job.id, { videoUUID: video.uuid }) 48 logger.info('Do not process job %d, video does not exist.', job.id)
49 return undefined 49 return undefined
50 } 50 }
51 51
52 // Transcoding in other resolution 52 // Transcoding in other resolution
53 if (payload.resolution) { 53 if (payload.resolution) {
54 await video.transcodeOriginalVideofile(payload.resolution, payload.isPortraitMode) 54 await video.transcodeOriginalVideofile(payload.resolution, payload.isPortraitMode || false)
55 55
56 await retryTransactionWrapper(onVideoFileTranscoderOrImportSuccess, video) 56 await retryTransactionWrapper(onVideoFileTranscoderOrImportSuccess, video)
57 } else { 57 } 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 {
87 const queue = this.queues[obj.type] 87 const queue = this.queues[obj.type]
88 if (queue === undefined) { 88 if (queue === undefined) {
89 logger.error('Unknown queue %s: cannot create job.', obj.type) 89 logger.error('Unknown queue %s: cannot create job.', obj.type)
90 return 90 throw Error('Unknown queue, cannot create job')
91 } 91 }
92 92
93 const jobArgs: Bull.JobOptions = { 93 const jobArgs: Bull.JobOptions = {