Fix for race on setting term

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2021-01-14 07:01:30 -08:00
parent 14e3319ba3
commit 9d9f0f7099

View File

@@ -1333,7 +1333,9 @@ func (n *raft) runAsCandidate() {
return
}
} else {
n.Lock()
n.term = vresp.term
n.Unlock()
n.writeTermVote()
n.switchToFollower(noLeader)
return