I was working on other stuff today (worldbuilding and some other writing), so I just did some quick work on the task runner in the last hour or so. I added the easy tests, which confirmed that the very core scheduling logic works as expected under simplified conditions, and made me suspect that I should change around the signature for the high-level helper function. Yeah, I did that. I can change it back later if it's a problem.
What's left to work on now is the kind of middle layer between them, which seems to have soaked up a lot of complexity that I'm not sure what else to do with. What's in the middle? A higher-order function that creates a pair of mutually recursive asynchronous closures over its arguments, some of which are mutable. The closure that is actually returned is pretty simple, but the workhorse closure starts off with a for-loop inside an asynchronous context manager inside a synchronous context manager, delegate execution to its argument, which has to be a nullary asynchronous function, and then checks whether to raise an exception based on the return value of that.
This is going to be at least another day of work to get tests written for it. Things to test:
- Having stuff in the for-loop or not
- Triggering the exception or not
- Confirming that raising the exception prevents dependent actions from executing
All right, I can see my way to testing that, but I don't want to do it right now. Soon™.
Time to wrap up. At the very least, even if I can't go outside yet because the humidity is seesawing between uncomfortable and dangerous, at least I'm getting overall work done at a pace that I like more.