Merge pull request #187 from prometheus/fix/goroutine-leak
Have goroutine exit on signal via defer block.
This commit is contained in:
commit
d46f2fd549
|
@ -164,14 +164,12 @@ func (t *tieredStorage) Serve() {
|
|||
var (
|
||||
flushMemoryTicker = time.Tick(t.flushMemoryInterval)
|
||||
writeMemoryTicker = time.Tick(t.writeMemoryInterval)
|
||||
reportTicker = time.NewTicker(time.Second)
|
||||
)
|
||||
defer reportTicker.Stop()
|
||||
|
||||
go func() {
|
||||
reportTicker := time.Tick(time.Second)
|
||||
|
||||
for {
|
||||
<-reportTicker
|
||||
|
||||
for _ = range reportTicker.C {
|
||||
t.reportQueues()
|
||||
}
|
||||
}()
|
||||
|
|
|
@ -508,7 +508,6 @@ func TestGetAllValuesForLabel(t *testing.T) {
|
|||
|
||||
for i, scenario := range scenarios {
|
||||
tiered, closer := newTestTieredStorage(t)
|
||||
defer closer.Close()
|
||||
for j, metric := range scenario.in {
|
||||
sample := model.Sample{
|
||||
Metric: model.Metric{model.MetricNameLabel: model.LabelValue(metric.metricName)},
|
||||
|
@ -525,6 +524,7 @@ func TestGetAllValuesForLabel(t *testing.T) {
|
|||
}
|
||||
}
|
||||
metricNames, err := tiered.GetAllValuesForLabel(model.MetricNameLabel)
|
||||
closer.Close()
|
||||
if err != nil {
|
||||
t.Fatalf("%d. Error getting metric names: %s", i, err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue