Skip to content

Commit

Permalink
Fix cluster panic bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tengattack committed Sep 8, 2018
1 parent c86dcf6 commit ad1d651
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions dkron/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ func (a *Agent) Start() error {
if a.config.Server {
a.StartServer()
}

if a.GRPCClient == nil {
a.GRPCClient = NewGRPCClient(nil)
}

if err := a.SetTags(a.config.Tags); err != nil {
log.WithError(err).Fatal("agent: Error setting RPC config tags")
}

go a.eventLoop()
a.ready = true

Expand Down Expand Up @@ -298,13 +307,6 @@ func (a *Agent) StartServer() {
log.WithError(err).Fatal("agent: RPC server failed to start")
}

if a.GRPCClient == nil {
a.GRPCClient = NewGRPCClient(nil)
}

if err := a.SetTags(a.config.Tags); err != nil {
log.WithError(err).Fatal("agent: Error setting RPC config tags")
}
a.participate()
}

Expand Down

0 comments on commit ad1d651

Please sign in to comment.