test:Fix two potential goroutine leaks (#8964)
Signed-off-by: lzhfromustc <lzhfromustc@gmail.com>
This commit is contained in:
parent
5afa606ecb
commit
d42be7be76
|
@ -1371,7 +1371,11 @@ func (tp mockdiscoveryProvider) Run(ctx context.Context, upCh chan<- []*targetgr
|
||||||
for i := range u.targetGroups {
|
for i := range u.targetGroups {
|
||||||
tgs[i] = &u.targetGroups[i]
|
tgs[i] = &u.targetGroups[i]
|
||||||
}
|
}
|
||||||
upCh <- tgs
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return
|
||||||
|
case upCh <- tgs:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
<-ctx.Done()
|
<-ctx.Done()
|
||||||
}
|
}
|
||||||
|
|
|
@ -408,6 +408,7 @@ func TestReleaseNoninternedString(t *testing.T) {
|
||||||
c := NewTestWriteClient()
|
c := NewTestWriteClient()
|
||||||
m := NewQueueManager(metrics, nil, nil, nil, "", newEWMARate(ewmaWeight, shardUpdateDuration), cfg, mcfg, nil, nil, c, defaultFlushDeadline, newPool(), newHighestTimestampMetric(), nil, false)
|
m := NewQueueManager(metrics, nil, nil, nil, "", newEWMARate(ewmaWeight, shardUpdateDuration), cfg, mcfg, nil, nil, c, defaultFlushDeadline, newPool(), newHighestTimestampMetric(), nil, false)
|
||||||
m.Start()
|
m.Start()
|
||||||
|
defer m.Stop()
|
||||||
|
|
||||||
for i := 1; i < 1000; i++ {
|
for i := 1; i < 1000; i++ {
|
||||||
m.StoreSeries([]record.RefSeries{
|
m.StoreSeries([]record.RefSeries{
|
||||||
|
|
Loading…
Reference in New Issue