aboutsummaryrefslogtreecommitdiffstats
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
commit38d5af73d40f1d94ef141b4e5991c7c7182a0028 (patch)
tree27a18265317f3d9f092e5fc2563cb1af4ed48915 /src/remake/local.rs
parent7aa649e5272e3e25f43e7fd4cb11516b0c882b03 (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(