From 2ef55f805e9f6e86f68721fac832dbcc5e8536c5 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Mon, 13 May 2019 12:26:05 +0100 Subject: plugin/metrics: fix failed reload (#2816) Fix metrics endpoint on a failed reload, follows the same lines as the previous PRs, see for e.g. 076b8d4f. Test with a Corefile with 2 server blocks and metrics enabled and then introducing a syntax error: ~~~ [ERROR] Restart failed: Corefile:5 - Error during parsing: Unknown directive 'jfkdjk' [ERROR] SIGUSR1: starting with listener file descriptors: Corefile:5 - Error during parsing: Unknown directive 'jfkdjk' ~~~ And then curl-ing the metrics endpoint. See #2659 and as this is the last one. Fixes: #2659 Getting this all right turns out to be tricky, also it's not easy testable which is something I should fix. Signed-off-by: Miek Gieben --- plugin/metrics/metrics.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'plugin/metrics/metrics.go') diff --git a/plugin/metrics/metrics.go b/plugin/metrics/metrics.go index 89c948aa6..acf31c0a8 100644 --- a/plugin/metrics/metrics.go +++ b/plugin/metrics/metrics.go @@ -137,9 +137,7 @@ func (m *Metrics) stopServer() error { } // OnFinalShutdown tears down the metrics listener on shutdown and restart. -func (m *Metrics) OnFinalShutdown() error { - return m.stopServer() -} +func (m *Metrics) OnFinalShutdown() error { return m.stopServer() } func keys(m map[string]struct{}) []string { sx := []string{} -- cgit v1.2.3