From 492fd5208a8ddce4b58b4e9cd0c0bd1cc9349e54 Mon Sep 17 00:00:00 2001 From: Areg Gareginyan Date: Fri, 22 Nov 2024 14:32:10 +0400 Subject: [PATCH] fix(job-queue-plugin): correct default worker options --- .../src/bullmq/bullmq-job-queue-strategy.ts | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/job-queue-plugin/src/bullmq/bullmq-job-queue-strategy.ts b/packages/job-queue-plugin/src/bullmq/bullmq-job-queue-strategy.ts index 1d1ad23e7e..888ed4ca2c 100644 --- a/packages/job-queue-plugin/src/bullmq/bullmq-job-queue-strategy.ts +++ b/packages/job-queue-plugin/src/bullmq/bullmq-job-queue-strategy.ts @@ -54,17 +54,18 @@ export class BullMQJobQueueStrategy implements InspectableJobQueueStrategy { private initOptions(injector: Injector): BullMQPluginOptions { const options = injector.get(BULLMQ_PLUGIN_OPTIONS); - if (!options.workerOptions) { - options.workerOptions = {}; + options.workerOptions = { + ...(options.workerOptions ?? { + removeOnComplete: { + age: 60 * 60 * 24 * 30, + count: 5000, + }, + removeOnFail: { + age: 60 * 60 * 24 * 30, + count: 5000, + }, + }) } - options.workerOptions.removeOnComplete = options.workerOptions.removeOnComplete || { - age: 60 * 60 * 24 * 30, - count: 5000, - }; - options.workerOptions.removeOnFail = options.workerOptions.removeOnFail || { - age: 60 * 60 * 24 * 30, - count: 5000, - }; return options }