From db86409369908a9311464114ec81eaac72dea15c Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 31 Aug 2021 17:43:59 -0400 Subject: [PATCH] Add `shield: bool` kwarg to `Portal.open_stream_from()` --- tractor/_portal.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tractor/_portal.py b/tractor/_portal.py index 44e8630..63c59ed 100644 --- a/tractor/_portal.py +++ b/tractor/_portal.py @@ -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