From e3a4b2128b19f31e5f210cf35cb08192b4cee33a Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Thu, 26 Jan 2017 00:13:34 -0500 Subject: [PATCH] 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. --- testutil/wait.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/testutil/wait.go b/testutil/wait.go index ae2439437b..40ae384ae0 100644 --- a/testutil/wait.go +++ b/testutil/wait.go @@ -1,19 +1,20 @@ package testutil import ( - "github.com/hashicorp/consul/consul/structs" "testing" "time" + + "github.com/hashicorp/consul/consul/structs" ) type testFn func() (bool, error) type errorFn func(error) func WaitForResult(test testFn, error errorFn) { - retries := 1000 + retries := 100 for retries > 0 { - time.Sleep(10 * time.Millisecond) + time.Sleep(100 * time.Millisecond) retries-- success, err := test()