Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
database/sql: add `lastUseTime` or similar to driverConn, add SetConnMaxIdleLefttime to DB #25232
I don't fully follow what you are suggesting. However, if a driver connection sets an idle timeout in the DSN or settings then the connection will close on idle. If that connection (still in the pool) attempts to be used, it will return driver.ErrBadConn and the pool will try to pull another one.
Actually, it may not be a bad idea to support a method to signal to the database connection pool that the driver is bad right away rather then retrying and risk getting all bad connections. I'm not sure how that would work of hand.