From 38233158206de92bb04df77da9878a7251119871 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 8 Dec 2020 16:26:59 +0100 Subject: [PATCH] lntest: go easy on goroutines when polling In high CPU usage scenarios such as our parallel itests, it seems that some goroutines just don't get any CPU time before our test timeouts expire. By polling 10 times less frequently, we hope to reduce the overall number of goroutines that are spawned because of the RPC requests within the polling code. --- lntest/harness.go | 2 +- lntest/wait/wait.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lntest/harness.go b/lntest/harness.go index 2b876116..cd77ffd2 100644 --- a/lntest/harness.go +++ b/lntest/harness.go @@ -223,7 +223,7 @@ func (n *NetworkHarness) SetUp(testCase string, lndArgs []string) error { // Now block until both wallets have fully synced up. expectedBalance := int64(btcutil.SatoshiPerBitcoin * 10) balReq := &lnrpc.WalletBalanceRequest{} - balanceTicker := time.NewTicker(time.Millisecond * 50) + balanceTicker := time.NewTicker(time.Millisecond * 200) defer balanceTicker.Stop() balanceTimeout := time.After(time.Second * 30) out: diff --git a/lntest/wait/wait.go b/lntest/wait/wait.go index 88cdb27d..a2981816 100644 --- a/lntest/wait/wait.go +++ b/lntest/wait/wait.go @@ -11,7 +11,7 @@ import ( // several running lnd nodes. This function gives callers a way to assert that // some property is upheld within a particular time frame. func Predicate(pred func() bool, timeout time.Duration) error { - const pollInterval = 20 * time.Millisecond + const pollInterval = 200 * time.Millisecond exitTimer := time.After(timeout) for {