History: resume the saved tracker at start; first build observations draw at once
The polling task never loaded the tracker the last run saved, so every restart began again from a baseline and dropped what had not yet reached a row. The empty bootstrap drawn at the first poll also started the one-minute wait for the first real observations. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bcc178330b
commit
c56aaefa72
3 files changed
+184
-16
No files matched your search
@@ -194,6 +194,8 @@ pub struct Task {
|
||||
/// When sccache's server was last tried to start, and why it is still not running.
|
||||
started_at: Option<i64>,
|
||||
start_error: Option<String>,
|
||||
/// Whether the totals the last run remembered have been put back into the shared state.
|
||||
resumed: bool,
|
||||
}
|
||||
|
||||
impl Task {
|
||||
@@ -217,6 +219,7 @@ impl Task {
|
||||
builds: Builds::new(),
|
||||
started_at: None,
|
||||
start_error: None,
|
||||
resumed: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,6 +243,12 @@ impl Task {
|
||||
(Probe::NotRunning, false) => {}
|
||||
}
|
||||
let mut state = app.lock();
|
||||
if !self.resumed {
|
||||
// Carry on where the last run stopped: its running totals are the base that the work
|
||||
// not yet in a row is counted from, so a restart neither drops it nor counts it twice.
|
||||
self.resumed = true;
|
||||
state.tracker = self.history.tracker();
|
||||
}
|
||||
state.client_version = version;
|
||||
match read {
|
||||
Ok((text, snapshot)) => {
|
||||
|
||||
@@ -147,7 +147,11 @@ impl Builds {
|
||||
self.draws = Resampled::new(&obs);
|
||||
self.times = times;
|
||||
self.stamp = Some(stamp);
|
||||
self.drawn_at = Some(now);
|
||||
// Drawing nothing is free, so it does not start the minute's wait: the first
|
||||
// observations are drawn at the very next poll.
|
||||
if stamp.0 > 0 {
|
||||
self.drawn_at = Some(now);
|
||||
}
|
||||
}
|
||||
|
||||
/// Time saved for one range's hits, from the draws already made.
|
||||
|
||||
Reference in new issue
Block a user