Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't unset actor global on root teardown #347

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tractor/_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ async def open_root_actor(
logger.cancel("Shutting down root actor")
await actor.cancel()
finally:
_state._current_actor = None
logger.runtime("Root actor terminated")


Expand Down
7 changes: 5 additions & 2 deletions tractor/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ReceiveMsgStream(trio.abc.ReceiveChannel):
'''
def __init__(
self,
ctx: 'Context', # typing: ignore # noqa
ctx: Context, # typing: ignore # noqa
rx_chan: trio.MemoryReceiveChannel,
_broadcaster: Optional[BroadcastReceiver] = None,

Expand All @@ -82,6 +82,9 @@ def __init__(
self._eoc: bool = False
self._closed: bool = False

def ctx(self) -> Context:
return self._ctx

# delegate directly to underlying mem channel
def receive_nowait(self):
msg = self._rx_chan.receive_nowait()
Expand Down Expand Up @@ -380,7 +383,7 @@ class Context:
# only set on the callee side
_scope_nursery: Optional[trio.Nursery] = None

_backpressure: bool = False
_backpressure: bool = True

async def send_yield(self, data: Any) -> None:

Expand Down