From 6491a185268ae546baa9b95a20b95d63c0e27915 Mon Sep 17 00:00:00 2001 From: Manuel Astudillo Date: Thu, 21 Dec 2023 16:14:25 +0100 Subject: [PATCH] fix(worker): throw error if connection is missing --- src/classes/worker.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/classes/worker.ts b/src/classes/worker.ts index df3a86afd3..a612583c2d 100644 --- a/src/classes/worker.ts +++ b/src/classes/worker.ts @@ -195,7 +195,7 @@ export class Worker< constructor( name: string, processor?: string | URL | null | Processor, - opts: WorkerOptions = {}, + opts?: WorkerOptions, Connection?: typeof RedisConnection, ) { super( @@ -207,6 +207,10 @@ export class Worker< Connection, ); + if (!opts || !opts.connection) { + throw new Error('Worker requires a connection'); + } + this.opts = { drainDelay: 5, concurrency: 1,