Remove refresh functionality that causes dashboard to hang

- Remove 'r' key handler that was causing hang on refresh
- Remove RefreshRequested event and check_refresh_request method
- Remove send_refresh_commands function and ZMQ command protocol
- Remove refresh_requested field from App struct
- Clean up status line text (refresh -> tick)

The refresh functionality was causing the dashboard to become unresponsive
when pressing 'r' key. This removes all refresh-related code to fix the issue.
This commit is contained in:
2025-10-16 01:00:39 +02:00
parent cfc89e7312
commit 7a664ef0fb
2 changed files with 2 additions and 76 deletions

View File

@@ -53,7 +53,7 @@ struct Cli {
#[arg(short = 'H', long, value_name = "HOST")]
host: Option<String>,
/// Interval (ms) to refresh dashboard when idle
/// Interval (ms) for dashboard tick rate
#[arg(long, default_value_t = 250)]
tick_rate: u64,
@@ -154,10 +154,6 @@ fn run_app(
while !app.should_quit() {
drain_app_events(app, event_rx);
// Check for refresh requests
if app.check_refresh_request() {
send_refresh_commands(app)?;
}
terminal.draw(|frame| ui::render(frame, app))?;
@@ -307,57 +303,6 @@ fn metrics_blocking_loop(
Ok(())
}
fn send_refresh_commands(app: &mut App) -> Result<()> {
let endpoints = app.zmq_endpoints();
if endpoints.is_empty() {
return Ok(());
}
let zmq_context = NativeZmqContext::new();
for endpoint in endpoints {
// Convert metrics endpoint (6130) to command endpoint (6131)
let command_endpoint = endpoint.replace(":6130", ":6131");
let socket = zmq_context.socket(zmq::REQ)?;
socket.set_linger(0)?;
socket.set_rcvtimeo(5000)?; // 5 second timeout
socket.set_sndtimeo(5000)?; // 5 second timeout
match socket.connect(&command_endpoint) {
Ok(()) => {
debug!("Sending refresh command to {}", command_endpoint);
match socket.send("refresh", 0) {
Ok(()) => {
// Wait for response
match socket.recv_string(0) {
Ok(Ok(response)) => {
debug!("Refresh response from {}: {}", command_endpoint, response);
// Update status via public method would be needed, for now just log
debug!("Refresh sent to agents - response: {}", response);
}
Ok(Err(e)) => {
warn!("String conversion error from {}: {:?}", command_endpoint, e);
}
Err(e) => {
warn!("No response from {}: {}", command_endpoint, e);
}
}
}
Err(e) => {
warn!("Failed to send refresh to {}: {}", command_endpoint, e);
}
}
}
Err(e) => {
warn!("Failed to connect to command endpoint {}: {}", command_endpoint, e);
}
}
}
Ok(())
}
fn handle_zmq_message(
message: &NativeZmqMessage,