1.3 KiB
Prompt
Distill repeated Actor._contexts.pop() machinery into a wrapper like the RPC-task registration helper so future teardown sites do not keep reconstructing the context-registry key independently. Preserve the existing lifecycle-specific cleanup behavior.
Response summary
Add idempotent Actor._drop_context() registry removal keyed from the context’s own channel and CID. Use it for caller context teardown and the strict callee-side RPC deregistration path.
Files changed
tractor/runtime/_runtime.py- own context-registry removal.tractor/runtime/_rpc.py- use the helper for callee teardown.tractor/_context.py- use the helper after caller teardown.
Human edits
The human identified the repeated registry-pop code and requested a central primitive analogous to _register_rpc_task(). The agent first suggested an async helper that also closed receive channels; the final design was narrowed to registry removal only so each lifecycle owner retains its existing closure, debugger, shielding, and error policy.