Straighten control flow in leader.go
This commit is contained in:
parent
f3c1f516b4
commit
cea98ae5f4
|
@ -93,8 +93,7 @@ RECONCILE:
|
|||
// Check if we need to handle initial leadership actions
|
||||
if !establishedLeader {
|
||||
if err := s.establishLeadership(); err != nil {
|
||||
s.logger.Printf("[ERR] consul: failed to establish leadership: %v",
|
||||
err)
|
||||
s.logger.Printf("[ERR] consul: failed to establish leadership: %v", err)
|
||||
goto WAIT
|
||||
}
|
||||
establishedLeader = true
|
||||
|
@ -124,20 +123,21 @@ WAIT:
|
|||
goto RECONCILE
|
||||
case member := <-reconcileCh:
|
||||
s.reconcileMember(member)
|
||||
case index := <-s.tombstoneGC.ExpireCh():
|
||||
go s.reapTombstones(index)
|
||||
case <-s.reassertLeaderCh:
|
||||
if establishedLeader {
|
||||
if !establishedLeader {
|
||||
continue
|
||||
}
|
||||
if err := s.revokeLeadership(); err != nil {
|
||||
s.logger.Printf("[ERR] consul: failed to revoke leadership: %v", err)
|
||||
goto WAIT
|
||||
continue
|
||||
}
|
||||
if err := s.establishLeadership(); err != nil {
|
||||
s.logger.Printf("[ERR] consul: failed to re-establish leadership: %v", err)
|
||||
goto WAIT
|
||||
continue
|
||||
}
|
||||
}
|
||||
case index := <-s.tombstoneGC.ExpireCh():
|
||||
go s.reapTombstones(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue