I have a nursery that I want to cancel at
t + 2, where
t is only known somewhere in the nursery.
Here’s what it should be doing:
async with trio.open_nursery() as nursery: run_scene(nursery) # exits when the scene finishes nursery.cancel_scope.deadline += now() + 2
run_scene is sync: all it can do is
start_soon tasks. I want to give the tasks that
run_scene spawned at most 2 seconds to close, once it
run_scene has exited. I can’t cancel straight away because
the async close tasks (whatever they are) have been
start_soon, not awaited.
But there’s no
now() function. Looking at the documentation for
move_on_at, I’m not even sure that I understand how to use it.
cancel_scope.deadline: An absolute time on the current run’s clock at which this scope will automatically become cancelled.
How can we know the internal time of the clock?
I looked at the source code of
move_on_after, because it has to use this
now() function, and it uses
Is there an other way to access the internal time? Because I should be able to use every regular function like
move_on_after without using