Only close recv chan if we get a ref

wip_fix_asyncio_gen_streaming
Tyler Goodlet 2021-06-10 13:58:06 -04:00
parent 5960330413
commit b29d2f7053
1 changed files with 3 additions and 1 deletions
tractor

View File

@ -359,6 +359,7 @@ class Portal:
fn_mod_path, fn_name = func_deats(func)
recv_chan: trio.ReceiveMemoryChannel = None
try:
cid, recv_chan, functype, first_msg = await self._submit(
fn_mod_path, fn_name, kwargs)
@ -390,6 +391,7 @@ class Portal:
await ctx.cancel()
finally:
if recv_chan is not None:
await recv_chan.aclose()
@dataclass