aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/job-queue.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/job-queue/job-queue.ts')
-rw-r--r--server/lib/job-queue/job-queue.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts
index 7a3a1bf82..4cda12b57 100644
--- a/server/lib/job-queue/job-queue.ts
+++ b/server/lib/job-queue/job-queue.ts
@@ -1,4 +1,4 @@
1import * as Bull from 'bull' 1import Bull, { Job, JobOptions, Queue } from 'bull'
2import { jobStates } from '@server/helpers/custom-validators/jobs' 2import { jobStates } from '@server/helpers/custom-validators/jobs'
3import { CONFIG } from '@server/initializers/config' 3import { CONFIG } from '@server/initializers/config'
4import { processVideoRedundancy } from '@server/lib/job-queue/handlers/video-redundancy' 4import { processVideoRedundancy } from '@server/lib/job-queue/handlers/video-redundancy'
@@ -30,12 +30,12 @@ import { processActivityPubHttpUnicast } from './handlers/activitypub-http-unica
30import { refreshAPObject } from './handlers/activitypub-refresher' 30import { refreshAPObject } from './handlers/activitypub-refresher'
31import { processActorKeys } from './handlers/actor-keys' 31import { processActorKeys } from './handlers/actor-keys'
32import { processEmail } from './handlers/email' 32import { processEmail } from './handlers/email'
33import { processMoveToObjectStorage } from './handlers/move-to-object-storage'
33import { processVideoFileImport } from './handlers/video-file-import' 34import { processVideoFileImport } from './handlers/video-file-import'
34import { processVideoImport } from './handlers/video-import' 35import { processVideoImport } from './handlers/video-import'
35import { processVideoLiveEnding } from './handlers/video-live-ending' 36import { processVideoLiveEnding } from './handlers/video-live-ending'
36import { processVideoTranscoding } from './handlers/video-transcoding' 37import { processVideoTranscoding } from './handlers/video-transcoding'
37import { processVideosViews } from './handlers/video-views' 38import { processVideosViews } from './handlers/video-views'
38import { processMoveToObjectStorage } from './handlers/move-to-object-storage'
39 39
40type CreateJobArgument = 40type CreateJobArgument =
41 { type: 'activitypub-http-broadcast', payload: ActivitypubHttpBroadcastPayload } | 41 { type: 'activitypub-http-broadcast', payload: ActivitypubHttpBroadcastPayload } |
@@ -59,7 +59,7 @@ export type CreateJobOptions = {
59 priority?: number 59 priority?: number
60} 60}
61 61
62const handlers: { [id in JobType]: (job: Bull.Job) => Promise<any> } = { 62const handlers: { [id in JobType]: (job: Job) => Promise<any> } = {
63 'activitypub-http-broadcast': processActivityPubHttpBroadcast, 63 'activitypub-http-broadcast': processActivityPubHttpBroadcast,
64 'activitypub-http-unicast': processActivityPubHttpUnicast, 64 'activitypub-http-unicast': processActivityPubHttpUnicast,
65 'activitypub-http-fetcher': processActivityPubHttpFetcher, 65 'activitypub-http-fetcher': processActivityPubHttpFetcher,
@@ -99,7 +99,7 @@ class JobQueue {
99 99
100 private static instance: JobQueue 100 private static instance: JobQueue
101 101
102 private queues: { [id in JobType]?: Bull.Queue } = {} 102 private queues: { [id in JobType]?: Queue } = {}
103 private initialized = false 103 private initialized = false
104 private jobRedisPrefix: string 104 private jobRedisPrefix: string
105 105
@@ -160,7 +160,7 @@ class JobQueue {
160 return 160 return
161 } 161 }
162 162
163 const jobArgs: Bull.JobOptions = { 163 const jobArgs: JobOptions = {
164 backoff: { delay: 60 * 1000, type: 'exponential' }, 164 backoff: { delay: 60 * 1000, type: 'exponential' },
165 attempts: JOB_ATTEMPTS[obj.type], 165 attempts: JOB_ATTEMPTS[obj.type],
166 timeout: JOB_TTL[obj.type], 166 timeout: JOB_TTL[obj.type],
@@ -177,11 +177,11 @@ class JobQueue {
177 count: number 177 count: number
178 asc?: boolean 178 asc?: boolean
179 jobType: JobType 179 jobType: JobType
180 }): Promise<Bull.Job[]> { 180 }): Promise<Job[]> {
181 const { state, start, count, asc, jobType } = options 181 const { state, start, count, asc, jobType } = options
182 182
183 const states = state ? [ state ] : jobStates 183 const states = state ? [ state ] : jobStates
184 let results: Bull.Job[] = [] 184 let results: Job[] = []
185 185
186 const filteredJobTypes = this.filterJobTypes(jobType) 186 const filteredJobTypes = this.filterJobTypes(jobType)
187 187