Fixes a startup ordering issue between Raft and Serf.

This fixes #2663 and fixes #1899. It's not super related to this PR,
but the startup time changes that this PR brings made this a lot worse
so I was able to track it down.
This commit is contained in:
James Phillips 2017-01-18 15:06:15 -08:00
parent 6ca0173907
commit 32be684fdf
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
1 changed files with 4 additions and 3 deletions

View File

@ -284,6 +284,10 @@ func NewServer(config *Config) (*Server, error) {
}
go s.wanEventHandler()
// Start monitoring leadership. This must happen after Serf is set up
// since it can fire events when leadership is obtained.
go s.monitorLeadership()
// Start ACL replication.
if s.IsACLReplicationEnabled() {
go s.runACLReplication()
@ -491,9 +495,6 @@ func (s *Server) setupRaft() error {
if err != nil {
return err
}
// Start monitoring leadership.
go s.monitorLeadership()
return nil
}