If connection was checked recently (15s timeout in engine), return it directly
Client tries to use connection, but it is broken
Client drops the object and return an error
The connection is returned to the pool
So in between health checks, a connection is always returned to the pool even if it is broken.
There is a mechanism in place in mobc to prevent a connection from re-entering the pool:
https://github.com/importcjj/mobc/blob/master/src/lib.rs#L648
Consider the following path:
So in between health checks, a connection is always returned to the pool even if it is broken. There is a mechanism in place in mobc to prevent a connection from re-entering the pool: https://github.com/importcjj/mobc/blob/master/src/lib.rs#L648
Currently the manager always return true (https://github.com/importcjj/mobc/blob/master/src/lib.rs#L187) since it doesn't override the method validate from the
Manager
trait (https://github.com/prisma/quaint/blob/master/src/pooled/manager.rs#L74). This means we needs to store information in the connection that the manager can read to deny re-entry. Unfortunately the currentQueryable
interface doesn't take a mutable reference to self so we would need to change that first for all methods (https://github.com/prisma/quaint/blob/master/src/connector/queryable.rs#L19) and then we could add a methodis_dead
orin_error
to that thevalidate
function would call.I can do the changes, but I wanted to check with the team before since it is significant.