mirror of
https://github.com/prometheus/prometheus
synced 2024-12-27 09:02:53 +00:00
fix(discovery): allow requireUpdate util to timeout in discovery/file/file_test.go.
The loop ran indefinitely if the condition isn't met. Before, each iteration created a new timer channel which was always outpaced by the other timer channel with smaller duration. minor detail: There was a memory leak: resources of the ~10 previous timers were constantly kept. With the fix, we may keep the resources of one timer around for defaultWait but this isn't worth the changes to make it right. Signed-off-by: machine424 <ayoubmrini424@gmail.com>
This commit is contained in:
parent
78c5ce3196
commit
afc05129f1
@ -193,9 +193,10 @@ func (t *testRunner) targets() []*targetgroup.Group {
|
||||
func (t *testRunner) requireUpdate(ref time.Time, expected []*targetgroup.Group) {
|
||||
t.Helper()
|
||||
|
||||
timeout := time.After(defaultWait)
|
||||
for {
|
||||
select {
|
||||
case <-time.After(defaultWait):
|
||||
case <-timeout:
|
||||
t.Fatalf("Expected update but got none")
|
||||
return
|
||||
case <-time.After(defaultWait / 10):
|
||||
|
Loading…
Reference in New Issue
Block a user