Skip to content

overhaul the way WaitFor and the MockSleepProvider work

eta requested to merge eta/arti:draft-overhaul-waitfor into main

Instead of racily advancing time forward, this commit attempts to rework how WaitFor works, such that it makes advances when all sleeper futures that have been created have been polled (by handing the MockSleepRuntime a Waker with which to wake up the WaitFor).

The above described mechanics work well enough for the double timeout test, but fail in the presence of code that spawns asynchronous / background tasks that must make progress before time is advanced for the test to work properly. In order to deal with these cases, a set of APIs are introduced in order to block time from being advanced until some code has run, and a carveout added in order to permit small advances in time where required.

This is an attempt to fix #149 (closed). It makes some tests far more (one might even say 100%!) reliable, but still breaks others occasionally; I'm presenting this as a draft just to get some feedback on it — does it make sense to people who aren't me, do people think it'll work, etc. :p

Edited by eta

Merge request reports