aboutsummaryrefslogtreecommitdiff
path: root/core/setup/health.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2016-04-29 07:28:35 +0100
committerGravatar Miek Gieben <miek@miek.nl> 2016-04-29 07:28:35 +0100
commit9e9d72655d865f2d136ad3b0439735cde53b679f (patch)
treef0c365ffb5fbe9599374ab2551463d610f79ebd6 /core/setup/health.go
parenta1478f891dd6849835973720df6b5651a8ea88fd (diff)
downloadcoredns-9e9d72655d865f2d136ad3b0439735cde53b679f.tar.gz
coredns-9e9d72655d865f2d136ad3b0439735cde53b679f.tar.zst
coredns-9e9d72655d865f2d136ad3b0439735cde53b679f.zip
Make middleware survive a restart (#142)
Make middleware that sets up a (http) handler survive a graceful restart. We calls the middleware's Shutdown function(s). If restart fails the Start function is called again. * middleware/health: OK * middleware/pprof: OK * middleware/metrics: OK All restart OK.
Diffstat (limited to 'core/setup/health.go')
-rw-r--r--core/setup/health.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/setup/health.go b/core/setup/health.go
index 608147b13..542cb3260 100644
--- a/core/setup/health.go
+++ b/core/setup/health.go
@@ -11,8 +11,9 @@ func Health(c *Controller) (middleware.Middleware, error) {
return nil, err
}
- h := health.Health{Addr: addr}
- c.Startup = append(c.Startup, h.ListenAndServe)
+ h := &health.Health{Addr: addr}
+ c.Startup = append(c.Startup, h.Start)
+ c.Shutdown = append(c.Shutdown, h.Shutdown)
return nil, nil
}