Skip to content
Snippets Groups Projects
Commit 16767fbd authored by ale's avatar ale
Browse files

trigger the update channel for slave -> slave transitions

Fixes a bug where master changes that did not involve the
local node were not triggering updates.
parent 353bb59e
No related branches found
No related tags found
No related merge requests found
......@@ -63,16 +63,15 @@ func (m *MasterElection) GetMasterAddr() string {
}
func (m *MasterElection) setState(state int) {
if m.State == state {
return
}
log.Printf("masterelection: %s -> %s",
stateToString(m.State),
stateToString(state))
// Order is important here: set state before triggering the
// update channel so that the receiver sees the right value.
m.State = state
if m.StateChange != nil {
m.StateChange <- state
}
m.State = state
}
func (m *MasterElection) stopper() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment