check for updateListeners errors

This commit is contained in:
Michael Stapelberg 2018-06-27 19:45:55 +02:00
parent 2b3cf0bf61
commit ab75e4a1b5
3 changed files with 9 additions and 3 deletions

View File

@ -100,7 +100,9 @@ func logic() error {
}
w.Write(b)
})
updateListeners()
if err := updateListeners(); err != nil {
return err
}
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGUSR1)
for range ch {

View File

@ -82,7 +82,9 @@ func logic() error {
log.Printf("cannot resolve DHCP hostnames: %v", err)
}
http.Handle("/metrics", srv.PrometheusHandler())
updateListeners(srv.Mux)
if err := updateListeners(srv.Mux); err != nil {
return err
}
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGUSR1)
for range ch {

View File

@ -110,7 +110,9 @@ func updateListeners() error {
func logic() error {
if *linger {
http.Handle("/metrics", promhttp.Handler())
updateListeners()
if err := updateListeners(); err != nil {
return err
}
}
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGUSR1)