mirror of
https://github.com/prometheus/prometheus
synced 2024-12-23 23:13:11 +00: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 New Issue
Block a user