Explorar o código

Fix the timer never fires bug.

Jing Yang %!s(int64=5) %!d(string=hai) anos
pai
achega
e7fa862b50
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/lib.rs

+ 1 - 1
src/lib.rs

@@ -321,7 +321,7 @@ impl Raft {
                     Some(timeout) => loop {
                         let ret =
                             election.signal.wait_until(&mut guard, timeout);
-                        let fired = ret.timed_out() && Instant::now() < timeout;
+                        let fired = ret.timed_out() && Instant::now() > timeout;
                         // If the timer has been updated, do not schedule,
                         // break so that we could cancel.
                         if timer_count != guard.0 {