Skip to content

Commit

Permalink
fix: event-bus-redis processor execute event before subscriber are lo…
Browse files Browse the repository at this point in the history
…aded (#10823)

* fix(worker): run worker after application start

* test(event-bus-redis): worker should initiate with autorun:false

---------

Co-authored-by: Suki Wang <[email protected]>
Co-authored-by: Oli Juhl <[email protected]>
  • Loading branch information
3 people authored Jan 9, 2025
1 parent 635d026 commit 6747a15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ describe("RedisEventBusService", () => {
{
connection: expect.any(Object),
prefix: "RedisEventBusService",
autorun: false
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ export default class RedisEventBusService extends AbstractEventBusModuleService
prefix: `${this.constructor.name}`,
...(moduleOptions.workerOptions ?? {}),
connection: eventBusRedisConnection,
autorun: false,
}
)
}
}

__hooks = {
onApplicationStart: async () => {
await this.bullWorker_?.run()
},
onApplicationShutdown: async () => {
await this.queue_.close()
// eslint-disable-next-line max-len
Expand Down

0 comments on commit 6747a15

Please sign in to comment.