From f604ef8cb3b4568d8f09c47b70cefb6f14bb0503 Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Thu, 16 Sep 2021 13:05:48 +0200 Subject: [PATCH] Wait for scheduler stop first (#1016) Before shuting down raft and store subsystem --- dkron/agent.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dkron/agent.go b/dkron/agent.go index 26a62e8b9..d8aea86ab 100644 --- a/dkron/agent.go +++ b/dkron/agent.go @@ -244,16 +244,16 @@ func (a *Agent) JoinLAN(addrs []string) (int, error) { func (a *Agent) Stop() error { a.logger.Info("agent: Called member stop, now stopping") - if a.config.Server { - a.raft.Shutdown() - a.Store.Shutdown() - } - if a.config.Server && a.sched.Started() { a.sched.Stop() a.sched.ClearCron() } + if a.config.Server { + a.raft.Shutdown() + a.Store.Shutdown() + } + if err := a.serf.Leave(); err != nil { return err }