Add else condition in function set_target_state (#107)

closes #105
This commit is contained in:
iamazy 2021-05-19 09:32:32 +08:00 committed by GitHub
parent cdbaba3a02
commit 2d51ebcbf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,8 @@ changelog
This changelog follows the patterns described here: https://keepachangelog.com/en/1.0.0/.
## [unreleased]
### fixed
- Fixed [#105](https://github.com/async-raft/async-raft/issues/105) where function `set_target_state` missing `else` condition.
## async-raft 0.6.0
The big news for this release is that we are now based on Tokio 1.0! Big shoutout to @xu-cheng for doing all of the heavy lifting for the Tokio 1.0 update, along with many other changes which are part of this release.

View File

@ -254,8 +254,9 @@ impl<D: AppData, R: AppDataResponse, N: RaftNetwork<D>, S: RaftStorage<D, R>> Ra
fn set_target_state(&mut self, target_state: State) {
if target_state == State::Follower && !self.membership.contains(&self.id) {
self.target_state = State::NonVoter;
} else {
self.target_state = target_state;
}
self.target_state = target_state;
}
/// Get the next election timeout, generating a new value if not set.