mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 13:14:05 -08:00
fix potential goroutine leaks (#10057)
Signed-off-by: Shihao Xia <charlesxsh@hotmail.com>
This commit is contained in:
parent
701545286d
commit
d26fd5c97b
|
@ -668,13 +668,16 @@ func TestTargetUpdatesOrder(t *testing.T) {
|
|||
discoveryManager.updatert = 100 * time.Millisecond
|
||||
|
||||
var totalUpdatesCount int
|
||||
provUpdates := make(chan []*targetgroup.Group)
|
||||
for _, up := range tc.updates {
|
||||
go newMockDiscoveryProvider(up...).Run(ctx, provUpdates)
|
||||
if len(up) > 0 {
|
||||
totalUpdatesCount += len(up)
|
||||
}
|
||||
}
|
||||
provUpdates := make(chan []*targetgroup.Group, totalUpdatesCount)
|
||||
|
||||
for _, up := range tc.updates {
|
||||
go newMockDiscoveryProvider(up...).Run(ctx, provUpdates)
|
||||
}
|
||||
|
||||
for x := 0; x < totalUpdatesCount; x++ {
|
||||
select {
|
||||
|
|
|
@ -668,13 +668,16 @@ func TestTargetUpdatesOrder(t *testing.T) {
|
|||
discoveryManager.updatert = 100 * time.Millisecond
|
||||
|
||||
var totalUpdatesCount int
|
||||
provUpdates := make(chan []*targetgroup.Group)
|
||||
for _, up := range tc.updates {
|
||||
go newMockDiscoveryProvider(up...).Run(ctx, provUpdates)
|
||||
if len(up) > 0 {
|
||||
totalUpdatesCount += len(up)
|
||||
}
|
||||
}
|
||||
provUpdates := make(chan []*targetgroup.Group, totalUpdatesCount)
|
||||
|
||||
for _, up := range tc.updates {
|
||||
go newMockDiscoveryProvider(up...).Run(ctx, provUpdates)
|
||||
}
|
||||
|
||||
for x := 0; x < totalUpdatesCount; x++ {
|
||||
select {
|
||||
|
|
Loading…
Reference in a new issue