mirror of
https://github.com/telemt/telemt.git
synced 2026-04-22 13:04:10 +03:00
Add security tests for pool writer and pool refill functionality
This commit is contained in:
@@ -71,17 +71,31 @@ impl MePool {
|
||||
}
|
||||
|
||||
if let Some((addr, expiry)) = earliest_quarantine {
|
||||
let remaining = expiry.saturating_duration_since(now);
|
||||
if remaining.is_zero() {
|
||||
return vec![addr];
|
||||
}
|
||||
drop(guard);
|
||||
debug!(
|
||||
%addr,
|
||||
wait_ms = expiry.saturating_duration_since(now).as_millis(),
|
||||
"All ME endpoints are quarantined for the DC group; retrying earliest one"
|
||||
wait_ms = remaining.as_millis(),
|
||||
"All ME endpoints quarantined; waiting for earliest to expire"
|
||||
);
|
||||
tokio::time::sleep(remaining).await;
|
||||
return vec![addr];
|
||||
}
|
||||
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(super) async fn connectable_endpoints_for_test(
|
||||
&self,
|
||||
endpoints: &[SocketAddr],
|
||||
) -> Vec<SocketAddr> {
|
||||
self.connectable_endpoints(endpoints).await
|
||||
}
|
||||
|
||||
pub(super) async fn has_refill_inflight_for_dc_key(&self, key: RefillDcKey) -> bool {
|
||||
let guard = self.refill_inflight_dc.lock().await;
|
||||
guard.contains(&key)
|
||||
|
||||
Reference in New Issue
Block a user