nestjs-pg-notify
nestjs-pg-notify copied to clipboard
Database connection is not closed when closing the App
Hey @pvarentsov, I have one question/issue when working with nestjs-pg-notify.
So when I run tests (with jest) that use the PgNotifyServer (with connectMicroservice), I get the classic "open handlers" error on jest: A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.
I tracked down the issue and it seems that the connection to the Postgres Database is not closed when the app (hybrid) is being closed. I even turned on the Shutdown Hooks!
Any idea how I can avoid keeping open handlers with this and close the connection properly?