nestjs/typeorm

Bring back keepConnectionAlive

RustySol opened this issue · 1 comments

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

I'm building a nestjs app that leverages typeorm and bullmq. Since both @nestjs/typeorm and @nestjs/bull have OnApplicationShutDown hook, sometimes the queue jobs fails to connect to the DB while running because typeorm connections have already been cleaned up, resulting in error like TypeORMError: Driver not Connected.

I found people with similar problems on Discord https://discord.com/channels/520622812742811698/1153822216362926131/1153822216362926131

Describe the solution you'd like

Wonder if we can bring back the keepConnectionAlive condition here 9001b56#diff-8461041b27d94fba5ee62d39aa05714c1440f36ce920b5414efd518377673fd2L113
So the database connections can be kept alive, and then the queue jobs can still access the database before it gets closed.

Teachability, documentation, adoption, migration strategy

As described above

What is the motivation / use case for changing the behavior?

As described above

This is no longer feasible with the latest version of TypeORM since connections are not globally scoped.

Please, use our Discord channel (support) for further questions.