summaryrefslogtreecommitdiffstats
path: root/src/remake/local.rs
diff options
context:
space:
mode:
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(