You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
last_used is set on retrieval from the pool. You can access the old metrics from inside a pre_recycle hook which also allows you to drop connections. Added benefit is that the pool will automatically try the next connection in the pool and the code calling Pool::get doesn't have to handle that.
@juchiast Does this fix your issue or do you still need a way to access this information from within code that uses the pool?
btw. you're right in a way that the last_used metric is pretty much useless outside of the hooks. It might make sense to add a last_used instant which returns the previous usage and not the current one:
Add
last_successful_statement: Option<Instant>
toMetrics
.Use case: can be used as a heuristic for connection health check. For example, don't do health check if last_successful_statement is less than 5 secs.
I tried
last_used
, but it's always 0ms right after you get the connection from the pool, therefore not useful.The text was updated successfully, but these errors were encountered: