-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Pool::acquire always sends a ping to the connection it returns #1743
Comments
You can do That does mean the pool will stop pinging the connections entirely, though. The idle reaper should test connections but it doesn't. |
What I would like is not to never test before acquiring, it is for sqlx to record the time of the latest successful ping or request on each connection, and to test the connection only if it is more than a few milliseconds ago. |
Looking at the code, it seems that the problem is still there, isn't it ? @abonander https://github.com/launchbadge/sqlx/blob/main/sqlx-core/src/pool/inner.rs#L363 The connection is going to be pinged again even if it had a successful interaction with the database half a millisecond ago. |
It doesn't log a query every |
Great, |
Hmmm, sounds like I rejoiced too quickly. The example code in before_acquire_logic panics. I'll open a new issue. Edit: done. #1912 (comment) |
Looking at my logs, it seems that sqlx sends a ping to a connection each time it is acquired from a pool, no matter how old the latest ping is. This results in a lot of unnecessary pings.
Would it be possible to add a configurable minimum delay before which connections can be acquired without ping ? So that when the application is busy, no ping is ever sent (sqlx knows that the connection is healthy because it has a recent successful request), but a ping is sent on the first request after a long period of inactivity.
The text was updated successfully, but these errors were encountered: