mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-23 11:41:54 -08:00
Merge pull request #23 from matttproud/feature/signal-handling
Improve interruption handling.
This commit is contained in:
commit
51bf3917df
9
main.go
9
main.go
|
@ -20,6 +20,7 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -30,10 +31,16 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
go func() {
|
||||
notifier := make(chan os.Signal)
|
||||
signal.Notify(notifier, os.Interrupt)
|
||||
<-notifier
|
||||
m.Close()
|
||||
os.Exit(0)
|
||||
}()
|
||||
|
||||
defer m.Close()
|
||||
|
||||
results := make(chan retrieval.Result, 4096)
|
||||
|
||||
t := &retrieval.Target{
|
||||
|
|
Loading…
Reference in a new issue