Merge pull request #1367 from halseth/waitpredicate-interval

lntest/harness: add pollIntervall to WaitPredicate
This commit is contained in:
Olaoluwa Osuntokun 2018-06-13 19:17:30 -07:00 committed by GitHub
commit 6830024faf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1042,8 +1042,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")