Fix status bar timer: use activity start time, tick every 1s

The status bar timer was showing turn/call elapsed times (0s, 0/60s)
instead of the activity's actual elapsed time. Use activity_started
from the ActivityEntry directly.

Add a 1s tick to the UI select loop when an activity is active so
the timer updates live.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-09 22:31:00 -04:00 committed by Kent Overstreet
parent 5fe22a5f23
commit c31d531954
2 changed files with 12 additions and 3 deletions

View file

@ -358,7 +358,11 @@ async fn run(
let mut startup_done = false;
let mut dirty = true; // render on first loop
let mut activity_tick = tokio::time::interval(std::time::Duration::from_secs(1));
activity_tick.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
loop {
let has_activity = !app.activity.is_empty();
tokio::select! {
biased;
@ -380,6 +384,10 @@ async fn run(
Some(channels) = channel_rx.recv() => {
app.set_channel_status(channels);
}
_ = activity_tick.tick(), if has_activity => {
dirty = true;
}
}
// State sync on every wake