Add `shield: bool` kwarg to `Portal.open_stream_from()`
parent
5182ee7782
commit
7857a9ac6d
|
@ -294,6 +294,7 @@ class Portal:
|
||||||
async def open_stream_from(
|
async def open_stream_from(
|
||||||
self,
|
self,
|
||||||
async_gen_func: Callable, # typing: ignore
|
async_gen_func: Callable, # typing: ignore
|
||||||
|
shield: bool = False,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
|
|
||||||
) -> AsyncGenerator[ReceiveMsgStream, None]:
|
) -> AsyncGenerator[ReceiveMsgStream, None]:
|
||||||
|
@ -320,7 +321,9 @@ class Portal:
|
||||||
ctx = Context(self.channel, cid, _portal=self)
|
ctx = Context(self.channel, cid, _portal=self)
|
||||||
try:
|
try:
|
||||||
# deliver receive only stream
|
# 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)
|
self._streams.add(rchan)
|
||||||
yield rchan
|
yield rchan
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue