Skip to content
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

Merged
merged 9 commits into from
Nov 15, 2023
Merged

fix: Disconnect db service on shutdown #327

merged 9 commits into from
Nov 15, 2023

Conversation

BobdenOs
Copy link
Contributor

Currently with HANA and Postgres the service does not disconnect with the default cds.test. So this registers the disconnect function to the shutdown event.

@@ -6,6 +6,12 @@ const cds = require('@sap/cds/lib')
/** @typedef {unknown} DatabaseDriver */

class DatabaseService extends cds.Service {

init() {
cds.on('shutdown', () => this.disconnect())
Copy link
Contributor

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('*')

Copy link
Contributor Author

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.

@johannes-vogel johannes-vogel added the next release pr to be checked for next release label Nov 6, 2023
@BobdenOs BobdenOs enabled auto-merge (squash) November 7, 2023 09:59
@BobdenOs BobdenOs merged commit 8471bda into main Nov 15, 2023
4 checks passed
@BobdenOs BobdenOs deleted the cap/14736 branch November 15, 2023 13:20
@cap-bots cap-bots mentioned this pull request Nov 15, 2023
@cap-bots cap-bots mentioned this pull request Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next release pr to be checked for next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants