Skip to main content

DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/IPC/Enhanced/ConnectionPool/
HealthChecker.rs

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