summaryrefslogtreecommitdiffstats
path: root/src/remake/local.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-26 23:38:22 +0100
committertv <tv@krebsco.de>2026-10-26 23:38:22 +0100
commitef4ec226ef720f4c3bdba5ae534465f67cda04ee (patch)
tree6a6882afa9a3a48ab42ad01178a0d7ea7ee8fc3e /src/remake/local.rs
parentd9b97e010db43e7307d095f215a889c7b851683c (diff)
remake worker wakes up when vote is due
Diffstat (limited to 'src/remake/local.rs')
-rw-r--r--src/remake/local.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/remake/local.rs b/src/remake/local.rs
index 60f7184..7810690 100644
--- a/src/remake/local.rs
+++ b/src/remake/local.rs
@@ -188,6 +188,14 @@ impl RemakeState {
self.lock().coordinating.contains(id)
}
+ /// How long until the vote `vote_due` scheduled is due, while it is ahead: the
+ /// worker wakes up for it (`switch`).
+ pub(crate) fn vote_wait(&self, now: UnixMillis) -> Option<Duration> {
+ let (_, due) = self.lock().vote_due.clone()?;
+ // A millisecond late rather than early: early, it would find nothing due.
+ (due > now).then(|| Duration::from_millis(due.0 - now.0 + 1))
+ }
+
/// When this node votes for `remake` (`vote::cast`): asked first, `now` plus
/// `delay()`; asked again, the same time.
pub(crate) fn vote_due(