diff options
Diffstat (limited to 'server/lib/job-queue/job-queue.ts')
-rw-r--r-- | server/lib/job-queue/job-queue.ts | 14 |
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 @@ | |||
1 | import * as Bull from 'bull' | 1 | import Bull, { Job, JobOptions, Queue } from 'bull' |
2 | import { jobStates } from '@server/helpers/custom-validators/jobs' | 2 | import { jobStates } from '@server/helpers/custom-validators/jobs' |
3 | import { CONFIG } from '@server/initializers/config' | 3 | import { CONFIG } from '@server/initializers/config' |
4 | import { processVideoRedundancy } from '@server/lib/job-queue/handlers/video-redundancy' | 4 | import { processVideoRedundancy } from '@server/lib/job-queue/handlers/video-redundancy' |
@@ -30,12 +30,12 @@ import { processActivityPubHttpUnicast } from './handlers/activitypub-http-unica | |||
30 | import { refreshAPObject } from './handlers/activitypub-refresher' | 30 | import { refreshAPObject } from './handlers/activitypub-refresher' |
31 | import { processActorKeys } from './handlers/actor-keys' | 31 | import { processActorKeys } from './handlers/actor-keys' |
32 | import { processEmail } from './handlers/email' | 32 | import { processEmail } from './handlers/email' |
33 | import { processMoveToObjectStorage } from './handlers/move-to-object-storage' | ||
33 | import { processVideoFileImport } from './handlers/video-file-import' | 34 | import { processVideoFileImport } from './handlers/video-file-import' |
34 | import { processVideoImport } from './handlers/video-import' | 35 | import { processVideoImport } from './handlers/video-import' |
35 | import { processVideoLiveEnding } from './handlers/video-live-ending' | 36 | import { processVideoLiveEnding } from './handlers/video-live-ending' |
36 | import { processVideoTranscoding } from './handlers/video-transcoding' | 37 | import { processVideoTranscoding } from './handlers/video-transcoding' |
37 | import { processVideosViews } from './handlers/video-views' | 38 | import { processVideosViews } from './handlers/video-views' |
38 | import { processMoveToObjectStorage } from './handlers/move-to-object-storage' | ||
39 | 39 | ||
40 | type CreateJobArgument = | 40 | type 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 | ||
62 | const handlers: { [id in JobType]: (job: Bull.Job) => Promise<any> } = { | 62 | const 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 | ||