forked from goodboy/tractor
1
0
Fork 0

Pop context on `.open_context()` exit

stricter_context_starting
Tyler Goodlet 2021-12-06 10:52:18 -05:00
parent f3432bd8fb
commit 4ea5c9b5db
1 changed files with 5 additions and 0 deletions

View File

@ -395,12 +395,14 @@ class Portal:
__tracebackhide__ = True __tracebackhide__ = True
fn_mod_path, fn_name = func_deats(func) fn_mod_path, fn_name = func_deats(func)
ctx = await self.actor.start_remote_task( ctx = await self.actor.start_remote_task(
self.channel, self.channel,
fn_mod_path, fn_mod_path,
fn_name, fn_name,
kwargs kwargs
) )
assert ctx._remote_func_type == 'context' assert ctx._remote_func_type == 'context'
msg = await ctx._recv_chan.receive() msg = await ctx._recv_chan.receive()
@ -497,6 +499,9 @@ class Portal:
f'value from callee `{result}`' f'value from callee `{result}`'
) )
# remove the context from runtime tracking
self.actor._contexts.pop((self.channel.uid, ctx.cid))
@dataclass @dataclass
class LocalPortal: class LocalPortal: