mirror of
https://github.com/prometheus/prometheus
synced 2024-12-28 09:42:22 +00:00
Have goroutine exit on signal via defer block.
This commit is contained in:
parent
af7ddc36e2
commit
5043c6fce7
@ -164,15 +164,20 @@ func (t *tieredStorage) Serve() {
|
||||
var (
|
||||
flushMemoryTicker = time.Tick(t.flushMemoryInterval)
|
||||
writeMemoryTicker = time.Tick(t.writeMemoryInterval)
|
||||
stopReport = make(chan bool)
|
||||
)
|
||||
defer func() { close(stopReport) }()
|
||||
|
||||
go func() {
|
||||
reportTicker := time.Tick(time.Second)
|
||||
|
||||
for {
|
||||
<-reportTicker
|
||||
|
||||
t.reportQueues()
|
||||
select {
|
||||
case <-reportTicker:
|
||||
t.reportQueues()
|
||||
case <-stopReport:
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user