forked from goodboy/tractor
1
0
Fork 0

Add `shield: bool` kwarg to `Portal.open_stream_from()`

tokio_backup
Tyler Goodlet 2021-08-31 17:43:59 -04:00
parent 2c96e85981
commit db86409369
1 changed files with 4 additions and 1 deletions

View File

@ -294,6 +294,7 @@ class Portal:
async def open_stream_from(
self,
async_gen_func: Callable, # typing: ignore
shield: bool = False,
**kwargs,
) -> AsyncGenerator[ReceiveMsgStream, None]:
@ -320,7 +321,9 @@ class Portal:
ctx = Context(self.channel, cid, _portal=self)
try:
# deliver receive only stream
async with ReceiveMsgStream(ctx, recv_chan) as rchan:
async with ReceiveMsgStream(
ctx, recv_chan, shield=shield
) as rchan:
self._streams.add(rchan)
yield rchan