mirror of
https://github.com/status-im/consul.git
synced 2025-01-27 22:16:23 +00:00
Runs revoke leadership actions only if we've established leadership.
This commit is contained in:
parent
57622c518a
commit
56fe6b65d1
@ -65,9 +65,6 @@ func (s *Server) monitorLeadership() {
|
|||||||
// leaderLoop runs as long as we are the leader to run various
|
// leaderLoop runs as long as we are the leader to run various
|
||||||
// maintenance activities
|
// maintenance activities
|
||||||
func (s *Server) leaderLoop(stopCh chan struct{}) {
|
func (s *Server) leaderLoop(stopCh chan struct{}) {
|
||||||
// Ensure we revoke leadership on stepdown
|
|
||||||
defer s.revokeLeadership()
|
|
||||||
|
|
||||||
// Fire a user event indicating a new leader
|
// Fire a user event indicating a new leader
|
||||||
payload := []byte(s.config.NodeName)
|
payload := []byte(s.config.NodeName)
|
||||||
if err := s.serfLAN.UserEvent(newLeaderEvent, payload, false); err != nil {
|
if err := s.serfLAN.UserEvent(newLeaderEvent, payload, false); err != nil {
|
||||||
@ -101,6 +98,7 @@ RECONCILE:
|
|||||||
goto WAIT
|
goto WAIT
|
||||||
}
|
}
|
||||||
establishedLeader = true
|
establishedLeader = true
|
||||||
|
defer s.revokeLeadership()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reconcile any missing data
|
// Reconcile any missing data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user