fix: event-bus-redis processor execute event before subscriber are loaded (#10823)
* fix(worker): run worker after application start * test(event-bus-redis): worker should initiate with autorun:false --------- Co-authored-by: Suki Wang <suki.wang@shoplineapp.com> Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
@@ -63,6 +63,7 @@ describe("RedisEventBusService", () => {
|
||||
{
|
||||
connection: expect.any(Object),
|
||||
prefix: "RedisEventBusService",
|
||||
autorun: false
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user