From ad1d651137220b392250501da2740e0f789efc4f Mon Sep 17 00:00:00 2001 From: tengattack Date: Wed, 5 Sep 2018 15:42:17 +0800 Subject: [PATCH] Fix cluster panic bug --- dkron/agent.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dkron/agent.go b/dkron/agent.go index d7f6fa2f0..5c691c602 100644 --- a/dkron/agent.go +++ b/dkron/agent.go @@ -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 @@ -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() }