Remove blocking TCP connectivity tests for fast startup
All checks were successful
Build and Release / build-and-release (push) Successful in 1m10s
All checks were successful
Build and Release / build-and-release (push) Successful in 1m10s
Eliminates test_tcp_connectivity function that was causing 5-10 second startup delays. ZMQ connections are non-blocking and we rely entirely on heartbeat mechanism for connectivity detection. This restores fast dashboard startup time.
This commit is contained in:
parent
33e700529e
commit
ec460496d8
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard-agent"
|
||||
version = "0.1.71"
|
||||
version = "0.1.72"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard"
|
||||
version = "0.1.71"
|
||||
version = "0.1.72"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -71,12 +71,6 @@ impl ZmqConsumer {
|
||||
pub async fn connect_to_host(&mut self, hostname: &str, port: u16) -> Result<()> {
|
||||
let address = format!("tcp://{}:{}", hostname, port);
|
||||
|
||||
// First test basic TCP connectivity to the port
|
||||
if let Err(e) = self.test_tcp_connectivity(hostname, port).await {
|
||||
error!("TCP connectivity test failed for {}: {}", address, e);
|
||||
return Err(e);
|
||||
}
|
||||
|
||||
match self.subscriber.connect(&address) {
|
||||
Ok(()) => {
|
||||
info!("Connected to agent at {}", address);
|
||||
@ -90,25 +84,6 @@ impl ZmqConsumer {
|
||||
}
|
||||
}
|
||||
|
||||
/// Test TCP connectivity to a host and port with timeout
|
||||
async fn test_tcp_connectivity(&self, hostname: &str, port: u16) -> Result<()> {
|
||||
let timeout = std::time::Duration::from_secs(3);
|
||||
|
||||
match tokio::time::timeout(timeout, tokio::net::TcpStream::connect((hostname, port))).await {
|
||||
Ok(Ok(_stream)) => {
|
||||
debug!("TCP connectivity test passed for {}:{}", hostname, port);
|
||||
Ok(())
|
||||
}
|
||||
Ok(Err(e)) => {
|
||||
debug!("TCP connectivity test failed for {}:{}: {}", hostname, port, e);
|
||||
Err(anyhow::anyhow!("TCP connection failed: {}", e))
|
||||
}
|
||||
Err(_) => {
|
||||
debug!("TCP connectivity test timed out for {}:{}", hostname, port);
|
||||
Err(anyhow::anyhow!("TCP connection timed out"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Connect to predefined hosts using their configuration
|
||||
pub async fn connect_to_predefined_hosts(&mut self, hosts: &std::collections::HashMap<String, crate::config::HostDetails>) -> Result<()> {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-dashboard-shared"
|
||||
version = "0.1.71"
|
||||
version = "0.1.72"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user