Fix now invalid `Actor._peers` ref..

main
Tyler Goodlet 2025-07-09 21:27:32 -04:00
parent 8538a9c591
commit 1f3cef5ed6
1 changed files with 3 additions and 4 deletions

View File

@ -48,7 +48,6 @@ from ._state import (
if TYPE_CHECKING: if TYPE_CHECKING:
from ._runtime import Actor from ._runtime import Actor
from .ipc._server import IPCServer
log = get_logger(__name__) log = get_logger(__name__)
@ -80,7 +79,7 @@ async def get_registry(
) )
else: else:
# TODO: try to look pre-existing connection from # TODO: try to look pre-existing connection from
# `IPCServer._peers` and use it instead? # `Server._peers` and use it instead?
async with ( async with (
_connect_chan(addr) as chan, _connect_chan(addr) as chan,
open_portal(chan) as regstr_ptl, open_portal(chan) as regstr_ptl,
@ -112,14 +111,14 @@ def get_peer_by_name(
) -> list[Channel]|None: # at least 1 ) -> list[Channel]|None: # at least 1
''' '''
Scan for an existing connection (set) to a named actor Scan for an existing connection (set) to a named actor
and return any channels from `IPCServer._peers: dict`. and return any channels from `Server._peers: dict`.
This is an optimization method over querying the registrar for This is an optimization method over querying the registrar for
the same info. the same info.
''' '''
actor: Actor = current_actor() actor: Actor = current_actor()
to_scan: dict[tuple, list[Channel]] = actor._peers.copy() to_scan: dict[tuple, list[Channel]] = actor.ipc_server._peers.copy()
# TODO: is this ever needed? creates a duplicate channel on actor._peers # TODO: is this ever needed? creates a duplicate channel on actor._peers
# when multiple find_actor calls are made to same actor from a single ctx # when multiple find_actor calls are made to same actor from a single ctx