Pop context on `.open_context()` exit
parent
f3432bd8fb
commit
4ea5c9b5db
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue