mirror of
https://github.com/prometheus/prometheus
synced 2024-12-29 02:02:17 +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 (
|
var (
|
||||||
flushMemoryTicker = time.Tick(t.flushMemoryInterval)
|
flushMemoryTicker = time.Tick(t.flushMemoryInterval)
|
||||||
writeMemoryTicker = time.Tick(t.writeMemoryInterval)
|
writeMemoryTicker = time.Tick(t.writeMemoryInterval)
|
||||||
|
stopReport = make(chan bool)
|
||||||
)
|
)
|
||||||
|
defer func() { close(stopReport) }()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
reportTicker := time.Tick(time.Second)
|
reportTicker := time.Tick(time.Second)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
<-reportTicker
|
select {
|
||||||
|
case <-reportTicker:
|
||||||
t.reportQueues()
|
t.reportQueues()
|
||||||
|
case <-stopReport:
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user