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:
@@ -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,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user