Browse Source

Cancel election at shutdown.

Jing Yang 3 năm trước cách đây
mục cha
commit
18103d0458
1 tập tin đã thay đổi với 1 bổ sung0 xóa
  1. 1 0
      src/election.rs

+ 1 - 0
src/election.rs

@@ -163,6 +163,7 @@ impl<Command: ReplicableCommand> Raft<Command> {
             // timer lock, so no one can change it. The kill() method will
             // not be able to notify this thread before `wait` is called.
             if !self.keep_running.load(Ordering::Relaxed) {
+                cancel_handle.take().map(|c| c.send(()));
                 break;
             }
             should_run = match deadline {