testify icon indicating copy to clipboard operation
testify copied to clipboard

`Eventually`/`EventuallyWithT` should only use one goroutine

Open cszczepaniak opened this issue 1 year ago • 8 comments

Currently, Eventually and EventuallyWithT spin up a goroutine per condition check. It also sets the ticker channel to nil while the condition is being checked, which makes it hard to understand to readers that the select will never hit case <-tick while the condition is running.

A better implementation may be to spin up a single goroutine which polls the condition repeatedly while the function waits on the result or a timeout.

This would also solve #1424 if implemented correctly.

cszczepaniak avatar Jul 30 '23 17:07 cszczepaniak