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 }