Add last_failure to worker state

The `WorkerSnapshot` now includes `last_failure`, which tracks the time
of the last recorded error. This allows the UI to display a more
accurate status, especially when a failure occurs after a recent
success.

The `pick_footer_status` function has been updated to prioritize
`last_failure`. If a failure occurred more recently than the last
success, the footer will show `Offline`, regardless of the success age.
This addresses scenarios where the server might have temporarily failed,
and the UI should reflect that immediately.

The `run_loop` function now updates `last_failure` upon transient or
terminal upload errors and poll failures. This ensures that the new
state information is correctly propagated.
This commit is contained in:
2026-04-18 13:45:21 +02:00
parent 305d739f56
commit 79e91246c6
4 changed files with 144 additions and 47 deletions
+4 -2
View File
@@ -524,7 +524,8 @@ impl DoctateApp {
return;
};
let snap = worker_rx.borrow().clone();
let last_age = snap.last_success.map(|i| i.elapsed());
let last_success_age = snap.last_success.map(|i| i.elapsed());
let last_failure_age = snap.last_failure.map(|i| i.elapsed());
let threshold = self
.config
.as_ref()
@@ -535,7 +536,8 @@ impl DoctateApp {
self.finalizing.is_some(),
snap.state,
snap.queue_len,
last_age,
last_success_age,
last_failure_age,
threshold,
);