Skip to content

Commit

Permalink
fix(worker): throw error if connection is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
manast committed Dec 21, 2023
1 parent f729be4 commit 6491a18
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/classes/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class Worker<
constructor(
name: string,
processor?: string | URL | null | Processor<DataType, ResultType, NameType>,
opts: WorkerOptions = {},
opts?: WorkerOptions,
Connection?: typeof RedisConnection,
) {
super(
Expand All @@ -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,
Expand Down

0 comments on commit 6491a18

Please sign in to comment.