Less dirty servers & fix python

This commit is contained in:
Lev Kokotov
2022-02-03 18:02:50 -08:00
parent baf2852f03
commit 83daaf92d1
7 changed files with 34 additions and 0 deletions

View File

@@ -50,6 +50,11 @@ impl ManageConnection for ServerPool {
async fn is_valid(&self, conn: &mut PooledConnection<'_, Self>) -> Result<(), Self::Error> {
let server = &mut *conn;
// Client disconnected before cleaning up
if server.in_transaction() {
return Err(Error::DirtyServer);
}
// If this fails, the connection will be closed and another will be grabbed from the pool quietly :-).
// Failover, step 1, complete.
match tokio::time::timeout(