Skip to content
This repository was archived by the owner on Sep 7, 2025. It is now read-only.

Commit 7c9de4e

Browse files
feat: increase terminal refresh interval
Signed-off-by: Alexander Knott <alexander.knott@r-kom.de>
1 parent 45b3d2a commit 7c9de4e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

sps/src/cli/status.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl StatusDisplay {
222222
let now = Instant::now();
223223
let time_diff = now.duration_since(self.last_speed_update).as_secs_f64();
224224

225-
if time_diff >= 0.25 {
225+
if time_diff >= 0.0625 {
226226
// Calculate current total bytes for all jobs with current download progress
227227
let current_active_bytes: u64 = self
228228
.jobs
@@ -400,9 +400,18 @@ pub async fn handle_events(_config: Config, mut event_rx: broadcast::Receiver<Pi
400400
let mut display = StatusDisplay::new();
401401
let mut logs_buffer = Vec::new();
402402
let mut pipeline_active = false;
403+
let mut refresh_interval = tokio::time::interval(tokio::time::Duration::from_millis(62));
404+
refresh_interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
403405

404406
loop {
405-
match event_rx.recv().await {
407+
tokio::select! {
408+
_ = refresh_interval.tick() => {
409+
if pipeline_active && display.header_printed {
410+
display.render();
411+
}
412+
}
413+
event_result = event_rx.recv() => {
414+
match event_result {
406415
Ok(event) => match event {
407416
PipelineEvent::PipelineStarted { total_jobs } => {
408417
pipeline_active = true;
@@ -579,6 +588,8 @@ pub async fn handle_events(_config: Config, mut event_rx: broadcast::Receiver<Pi
579588
Err(broadcast::error::RecvError::Lagged(_)) => {
580589
// Ignore lag for now
581590
}
591+
}
592+
}
582593
}
583594
}
584595
}

0 commit comments

Comments
 (0)