Skip to content

Commit

Permalink
fix: ready and error events are allowed wihtin sub workers
Browse files Browse the repository at this point in the history
  • Loading branch information
simllll committed Aug 14, 2022
1 parent 9d20a04 commit cb4228c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class Agenda extends EventEmitter {
on(event: 'ready', listener: () => void): this;
on(event: 'error', listener: (error: Error) => void): this;
on(event: string, listener: (...args) => void): this {
if (this.forkedWorker && event !== 'ready') {
if (this.forkedWorker && event !== 'ready' && event !== 'error') {
const warning = new Error(`calling on(${event}) during a forkedWorker has no effect!`);
console.warn(warning.message, warning.stack);
return this;
Expand Down

0 comments on commit cb4228c

Please sign in to comment.