-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Disconnect db service on shutdown #327
Conversation
@@ -6,6 +6,12 @@ const cds = require('@sap/cds/lib') | |||
/** @typedef {unknown} DatabaseDriver */ | |||
|
|||
class DatabaseService extends cds.Service { | |||
|
|||
init() { | |||
cds.on('shutdown', () => this.disconnect()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need to implement something that disconnects all tenant pools in multitenancy mode. Something like disconnect('*')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disconnect(undefined)
should match all tenants. Will update the disconnect
function to just go over all pools.
Currently with
HANA
andPostgres
the service does not disconnect with the defaultcds.test
. So this registers thedisconnect
function to theshutdown
event.