diff options
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r-- | server/lib/job-queue/job-queue.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts index 53d6b6a9c..0eab720d9 100644 --- a/server/lib/job-queue/job-queue.ts +++ b/server/lib/job-queue/job-queue.ts | |||
@@ -108,7 +108,7 @@ class JobQueue { | |||
108 | private constructor () { | 108 | private constructor () { |
109 | } | 109 | } |
110 | 110 | ||
111 | init () { | 111 | init (produceOnly = false) { |
112 | // Already initialized | 112 | // Already initialized |
113 | if (this.initialized === true) return | 113 | if (this.initialized === true) return |
114 | this.initialized = true | 114 | this.initialized = true |
@@ -124,6 +124,12 @@ class JobQueue { | |||
124 | 124 | ||
125 | for (const handlerName of (Object.keys(handlers) as JobType[])) { | 125 | for (const handlerName of (Object.keys(handlers) as JobType[])) { |
126 | const queue = new Bull(handlerName, queueOptions) | 126 | const queue = new Bull(handlerName, queueOptions) |
127 | |||
128 | if (produceOnly) { | ||
129 | queue.pause(true) | ||
130 | .catch(err => logger.error('Cannot pause queue %s in produced only job queue', handlerName, { err })) | ||
131 | } | ||
132 | |||
127 | const handler = handlers[handlerName] | 133 | const handler = handlers[handlerName] |
128 | 134 | ||
129 | queue.process(this.getJobConcurrency(handlerName), handler) | 135 | queue.process(this.getJobConcurrency(handlerName), handler) |