Sleep for longer, but try less often
This fixes an issue where the system can quickly run out of file descriptors because they are accumulating faster than the kernel can release them.
This commit is contained in:
parent
4742adb36c
commit
efc1c8614b
|
@ -1,19 +1,20 @@
|
||||||
package testutil
|
package testutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hashicorp/consul/consul/structs"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/hashicorp/consul/consul/structs"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testFn func() (bool, error)
|
type testFn func() (bool, error)
|
||||||
type errorFn func(error)
|
type errorFn func(error)
|
||||||
|
|
||||||
func WaitForResult(test testFn, error errorFn) {
|
func WaitForResult(test testFn, error errorFn) {
|
||||||
retries := 1000
|
retries := 100
|
||||||
|
|
||||||
for retries > 0 {
|
for retries > 0 {
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
retries--
|
retries--
|
||||||
|
|
||||||
success, err := test()
|
success, err := test()
|
||||||
|
|
Loading…
Reference in New Issue