Closed jaeecheveste closed 10 months ago
Did you manage to solve the problem? I have similar problem. Each new import of BullModule.registerQueue to the module - create a new connection to the Redis.
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.
Is there an existing issue for this?
Current behavior
Steps: I have a dynamic module, lets call it:
export class UtilModule { static async forRoot(): Promise<DynamicModule> { return { module: UtilModule, imports: [ BullModule.registerQueue({ name: 'example_queue' }), ], providers: [], exports: [], }; } }
We also have AModule and BModule using UtilModule, for example:
export class AModule { static async forRoot(): Promise<DynamicModule> { return { module: AModule, imports: [UtilModule.forRoot()], providers: [], exports: [], }; } } export class BModule { static async forRoot(): Promise<DynamicModule> { return { module: BModule, imports: [UtilModule.forRoot()], providers: [], exports: [], }; } }
And UtilModule is loaded twice. I compared with not using BullModule and UtilModule is loaded 1.
Any thoughts?
Minimum reproduction code
https://github.com/jaeecheveste/nest-bull-demo.git
Steps to reproduce
Expected behavior
Util Module dependencies to be loaded 1 and every reference should be take from the injector.
Package version
10.0.1
Bull version
4.11.3
NestJS version
10.0.0
Node.js version
16.20.2
In which operating systems have you tested?
Other
No response