macro_rules! get_cache_store_client {
($pools:expr, $error:expr, $client:ident $code:block) => {{
let mut last_error = $error;
for (pool, target) in $pools {
match pool.try_get() {
Some(mut $client) => {
debug!("acquired cache store client at: {}", target);
return $code;
}
None => {
warn!("could not acquire cache store client from sub-pool");
last_error = $error
}
}
}
error!("failed getting a cache store client from all pools");
Err(last_error)
}};
}