forked from goodboy/tractor
Such that we are able to (finally) detect when we should `Context._scope.cancel()` specifically when the `.parent_task` is **not** blocking on receiving from the underlying `._rx_chan`, since if the task is blocking on `.receive()` it will call `.cancel()` implicitly. This is a lot to explain with very little code actually needed for the implementation (are we like `trio` yet anyone?? XD) but the main jist is that `Context._maybe_cancel_and_set_remote_error()` needed the additional case of calling `._scope.cancel()` whenever we know that a remote-error/ctxc won't be immediately handled, bc user code is doing non `Context`-API things, and result in a similar outcome as if that task was waiting on `Context.wait_for_result()` or `.__aexite__()`. Impl details, - add a new `._is_blocked_on_rx_chan()` method which predicates whether the (new) `.parent_task` is blocking on `._rx_chan.receive()`. * see various stipulations about the current impl and how we might need to adjust for the future given `trio`'s commitment to the `Task.custom_sleep_data` attr.. - add `.parent_task`, a pub wrapper for `._task`. - check for `not ._is_blocked_on_rx_chan()` before manually cancelling the local `.parent_task` - minimize the surrounding branch case expressions. Other, - tweak a couple logs. - add a new `.cancel()` pre-started msg. - mask the `.cancel_called` setter, it's only (been) used for tracing. - todos around maybe moving the `._nursery` allocation "around" the `.start_remote_task()` call and various subsequent tweaks therein. |
||
---|---|---|
.. | ||
_testing | ||
devx | ||
experimental | ||
ipc | ||
msg | ||
trionics | ||
__init__.py | ||
_addr.py | ||
_child.py | ||
_clustering.py | ||
_context.py | ||
_discovery.py | ||
_entry.py | ||
_exceptions.py | ||
_forkserver_override.py | ||
_mp_fixup_main.py | ||
_multiaddr.py | ||
_portal.py | ||
_root.py | ||
_rpc.py | ||
_runtime.py | ||
_spawn.py | ||
_state.py | ||
_streaming.py | ||
_supervise.py | ||
log.py | ||
to_asyncio.py |