-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 debug toolbar db connection count #5172
Fix debug toolbar db connection count #5172
Conversation
Co-authored-by: John Paul E. Balandan, CPA <[email protected]>
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.
It looks like it's already trying to count the connections that it finds in the constructor. Have you verified what is going wrong there?
It seems to me that the toolbar's Database collector is created before a database connection is made. Its constructor gets the connections from the config, but at that time, nothing's connected and an empty array is returned. That can be an alternative too, refreshing the connection array. |
Ah - good point. I think doing a |
Alright, changed the PR accordingly. |
Looks good. Thanks! |
Fixes #5160
Description
The debug toolbar's database tab showed X queries 0 connections - the count of used connections was not reported.
The change counts the unique (name) connections while iterating through the queries, and saves them in a new static variable. Then this variable is used to display the count.
Checklist: