lntest/harness: add pollIntervall to WaitPredicate
This commit adds a poll 20 ms interval to WaitPredicate, similar to what is done for WaitInvariant. This makes the predicate not being checked super-rapidly, potentially filling the logs with useless info over the wait predicate interval.
This commit is contained in:
parent
2e838abb3f
commit
0316523bb5
@ -1035,8 +1035,12 @@ func (n *NetworkHarness) AssertChannelExists(ctx context.Context,
|
||||
// several running lnd nodes. This function gives callers a way to assert that
|
||||
// some property is upheld within a particular time frame.
|
||||
func WaitPredicate(pred func() bool, timeout time.Duration) error {
|
||||
const pollInterval = 20 * time.Millisecond
|
||||
|
||||
exitTimer := time.After(timeout)
|
||||
for {
|
||||
<-time.After(pollInterval)
|
||||
|
||||
select {
|
||||
case <-exitTimer:
|
||||
return fmt.Errorf("predicate not satisfied after time out")
|
||||
|
Loading…
Reference in New Issue
Block a user