From 4177c35eba2b20914c01a93118d0127874e926c6 Mon Sep 17 00:00:00 2001 From: Michal Witkowski Date: Tue, 9 May 2017 17:00:54 +0100 Subject: [PATCH] Fixup sighup for P2 TSDB init #2699 --- cmd/prometheus/main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index cdb85f13b..a72d26b35 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -78,6 +78,11 @@ func Main() int { reloadables []Reloadable ) + // Make sure that sighup handler is registered with a redirect to the channel before the potentially + // long and synchronous tsdb init. + hup := make(chan os.Signal) + hupReady := make(chan bool) + signal.Notify(hup, syscall.SIGHUP) localStorage, err := tsdb.Open(cfg.localStoragePath, prometheus.DefaultRegisterer, &cfg.tsdb) if err != nil { log.Errorf("Opening storage failed: %s", err) @@ -136,9 +141,6 @@ func Main() int { // Wait for reload or termination signals. Start the handler for SIGHUP as // early as possible, but ignore it until we are ready to handle reloading // our config. - hup := make(chan os.Signal) - hupReady := make(chan bool) - signal.Notify(hup, syscall.SIGHUP) go func() { <-hupReady for {