From d903a963eeb3454996846811fb850ceb8c4fea81 Mon Sep 17 00:00:00 2001 From: Chris O'Haver Date: Wed, 6 Jul 2022 13:52:18 -0400 Subject: [PATCH] dont lameduck when reloading (#5472) Signed-off-by: Chris O'Haver --- plugin/health/health.go | 12 ++++++++++++ plugin/health/setup.go | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plugin/health/health.go b/plugin/health/health.go index a71c00c8c..c69b221ec 100644 --- a/plugin/health/health.go +++ b/plugin/health/health.go @@ -70,3 +70,15 @@ func (h *health) OnFinalShutdown() error { h.nlSetup = false return nil } + +func (h *health) OnReload() error { + if !h.nlSetup { + return nil + } + + h.stop() + + h.ln.Close() + h.nlSetup = false + return nil +} diff --git a/plugin/health/setup.go b/plugin/health/setup.go index 624d88dd5..e9163ad44 100644 --- a/plugin/health/setup.go +++ b/plugin/health/setup.go @@ -20,7 +20,7 @@ func setup(c *caddy.Controller) error { h := &health{Addr: addr, lameduck: lame} c.OnStartup(h.OnStartup) - c.OnRestart(h.OnFinalShutdown) + c.OnRestart(h.OnReload) c.OnFinalShutdown(h.OnFinalShutdown) c.OnRestartFailed(h.OnStartup)