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.
This commit is contained in:
Oliver Gugger 2020-12-08 16:26:59 +01:00
parent 4d2a12e552
commit 3823315820
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
2 changed files with 2 additions and 2 deletions

@ -223,7 +223,7 @@ func (n *NetworkHarness) SetUp(testCase string, lndArgs []string) error {
// Now block until both wallets have fully synced up. // Now block until both wallets have fully synced up.
expectedBalance := int64(btcutil.SatoshiPerBitcoin * 10) expectedBalance := int64(btcutil.SatoshiPerBitcoin * 10)
balReq := &lnrpc.WalletBalanceRequest{} balReq := &lnrpc.WalletBalanceRequest{}
balanceTicker := time.NewTicker(time.Millisecond * 50) balanceTicker := time.NewTicker(time.Millisecond * 200)
defer balanceTicker.Stop() defer balanceTicker.Stop()
balanceTimeout := time.After(time.Second * 30) balanceTimeout := time.After(time.Second * 30)
out: out:

@ -11,7 +11,7 @@ import (
// several running lnd nodes. This function gives callers a way to assert that // several running lnd nodes. This function gives callers a way to assert that
// some property is upheld within a particular time frame. // some property is upheld within a particular time frame.
func Predicate(pred func() bool, timeout time.Duration) error { func Predicate(pred func() bool, timeout time.Duration) error {
const pollInterval = 20 * time.Millisecond const pollInterval = 200 * time.Millisecond
exitTimer := time.After(timeout) exitTimer := time.After(timeout)
for { for {