-
-
Notifications
You must be signed in to change notification settings - Fork 320
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 when tenant has no users #701
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
1 similar comment
20af583
to
56393c4
Compare
c008137
to
c0e5045
Compare
|
||
def handle_info(:shutdown, %{db_conn_pid: db_conn_pid} = state) do | ||
Logger.info("Tenant has no connected users, database connection will be terminated") | ||
:ok = GenServer.stop(db_conn_pid) |
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.
What happens after this? Is the process going to keep checking and trying to kill a db_conn_pid that doesn't exist?
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.
Since we're monitoring the reference of this connection it will be caught by the handle info for that effect and kill itself
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.
Roger. Okay LGTM.
@filipecabaco take the nits if you want and feel free to merge whenever. |
776dcd3
to
cff7818
Compare
To ensure that we limit the amount of connections to a tenant database, we will check if that tenant has any users and if not, we kill the database connection.
cff7818
to
6991704
Compare
🎉 This PR is included in version 2.25.5 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
What kind of change does this PR introduce?
To ensure that we limit the amount of connections to a tenant database, we will check if that tenant has any users and if not, we kill the database connection.