Skip to content

Commit

Permalink
fix(job-queue-plugin): Close redis connection on destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Oct 7, 2021
1 parent f26ad4b commit 64ebdd1
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ export class BullMQJobQueueStrategy implements InspectableJobQueueStrategy {
}).on('error', (e: any) => Logger.error(`BullMQ Scheduler error: ${e.message}`, loggerCtx, e.stack));
}

async destroy() {
await Promise.all([this.queue.close(), this.worker.close(), this.scheduler.close()]);
}

async add<Data extends JobData<Data> = {}>(job: Job<Data>): Promise<Job<Data>> {
const retries = this.options.setRetries?.(job.queueName, job) ?? job.retries;
const backoff = this.options.setBackoff?.(job.queueName, job) ?? {
Expand Down

0 comments on commit 64ebdd1

Please sign in to comment.