Created
December 12, 2019 00:14
-
-
Save bowrocker/9986fddddb14a36fe9c188ab1bcdc512 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn check_pool_connections<C>( | |
protected_data: ProtectedData<C>, | |
rebalance_check: RebalanceCheck, | |
log: Logger, | |
) where | |
C: Connection, | |
{ | |
let mut connection_data = protected_data.connection_data_lock(); | |
debug!( | |
log, | |
"Performing connection check on {} connections", | |
connection_data.connections.len() | |
); | |
connection_data.connections.retain(|pair| match pair { | |
ConnectionKeyPair((_key, Some(conn))) => conn.is_valid(), | |
ConnectionKeyPair((_key, None)) => { | |
warn!(log, "found malformed connection"); | |
false | |
} | |
}); | |
info!(log, "calling get_lock on rebalance check"); | |
let mut rebalance = rebalance_check.get_lock(); | |
if !*rebalance { | |
*rebalance = true; | |
info!(log, "calling condvar_nontify() on rebalance check"); | |
rebalance_check.condvar_notify(); | |
info!(log, "called condvar_notify() rebalance check"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment