`Connection is closed` error
Hi!
I'm using @nestjs/bull and bull, and am running into the same issue as reported already in the @nestjs/bull repository (https://github.com/nestjs/bull/issues/2685) and bullmq repository (https://github.com/taskforcesh/bullmq/issues/2686), and thought it worth reporting it here as well, since unlike the other reporters, I run into this issue when using bull, not bullmq.
We cannot say it is the same issue. You should provide reproducible code, or we will not be able to solve it.
Something like this should do the trick:
- Have an
onApplicationBootstrapmethod that interacts with bull queus - Have a test suite that starts that app in
beforeEach, but incorrectly closes it inafterEach. - Add multiple tests that do as little as possible so the app starts and closes multiple times in rapid succession.
@Module({
imports: [
BullModule.forRoot(),
BullModule.registerQueue('hello')
]
})
class AppModule {
constructor(private moduleRef: ModuleRef) {}
async onApplicationBootstrap() {
const queue: Queue = this.moduleRef.get(
getQueueToken('hello'),
{ strict: false },
)
await queue.add('hello', {})
}
}
and for the test suite:
beforeEach(async () => await module.init())
afterEach(() => { module.close() })
nota bene: the promise of module.close() is not awaited or returned to the afterEach hook.
@manast is there anything I can do to help out further?