Skip to content

Commit

Permalink
Revert changes to leader loop
Browse files Browse the repository at this point in the history
  • Loading branch information
otoolep committed Oct 18, 2024
1 parent c40128b commit 70bc87c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ func (r *Raft) leaderLoop() {

// Track whether leadership has been asserted. This becomes true once
// the leader has committed at least one log in this term.
leadershipAsserted := false
//leadershipAsserted := false

for r.getState() == Leader {
r.mainThreadSaturation.sleeping()
Expand Down Expand Up @@ -802,7 +802,7 @@ func (r *Raft) leaderLoop() {
oldCommitIndex := r.getCommitIndex()
commitIndex := r.leaderState.commitment.getCommitIndex()
r.setCommitIndex(commitIndex)
leadershipAsserted = true
//leadershipAsserted = true

// New configuration has been committed, set it as the committed
// value.
Expand Down Expand Up @@ -884,11 +884,11 @@ func (r *Raft) leaderLoop() {
v.respond(nil)
}

case v := <-r.assertedCh:
r.mainThreadSaturation.working()
v.asserted = leadershipAsserted
v.term = r.getCurrentTerm()
v.respond(nil)
// case v := <-r.assertedCh:
// r.mainThreadSaturation.working()
// v.asserted = leadershipAsserted
// v.term = r.getCurrentTerm()
// v.respond(nil)

case future := <-r.userRestoreCh:
r.mainThreadSaturation.working()
Expand Down

0 comments on commit 70bc87c

Please sign in to comment.