Fixup sighup for P2 TSDB init #2699

This commit is contained in:
Michal Witkowski 2017-05-09 17:00:54 +01:00
parent ff0ee264ae
commit 4177c35eba
1 changed files with 5 additions and 3 deletions

View File

@ -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 {