Mountain/IPC/Enhanced/ConnectionPool/HealthChecker.rs
1#![allow(non_snake_case)]
2
3//! Per-connection health-probe helper used by
4//! `Pool::Struct::start_health_monitoring`. Currently runs a
5//! simulated 10ms ping; real implementations would send a
6//! protocol-level keepalive.
7
8use std::time::{Duration, Instant};
9
10use crate::IPC::Enhanced::ConnectionPool::ConnectionHandle;
11
12pub struct Struct {
13 pub(super) ping_timeout:Duration,
14}
15
16impl Struct {
17 pub(super) fn new() -> Self { Self { ping_timeout:Duration::from_secs(5) } }
18
19 pub(super) async fn check_connection_health(&self, _handle:&mut ConnectionHandle::Struct) -> bool {
20 let start_time = Instant::now();
21 tokio::time::sleep(Duration::from_millis(10)).await;
22 let response_time = start_time.elapsed();
23 response_time < self.ping_timeout
24 }
25}