Skip to content

Commit

Permalink
Removes unused leader observation.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Phillips committed Jun 28, 2016
1 parent 66c8ddc commit b7e8a11
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
5 changes: 0 additions & 5 deletions observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ type Observation struct {
Data interface{}
}

// LeaderObservation is used for the data when leadership changes.
type LeaderObservation struct {
leader string
}

// nextObserverId is used to provide a unique ID for each observer to aid in
// deregistration.
var nextObserverId uint64
Expand Down
4 changes: 0 additions & 4 deletions raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,8 @@ func (r *Raft) Leader() ServerAddress {
// setLeader is used to modify the current leader of the cluster
func (r *Raft) setLeader(leader ServerAddress) {
r.leaderLock.Lock()
oldLeader := r.leader
r.leader = leader
r.leaderLock.Unlock()
if oldLeader != leader {
r.observe(LeaderObservation{leader: string(leader)})
}
}

// Apply is used to apply a command to the FSM in a highly consistent
Expand Down

2 comments on commit b7e8a11

@hsanjuan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I USED it @slackpad ...

@james-lawrence
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also used it. reacting to different state changes of peers can be important.

Please sign in to comment.