forked from goodboy/tractor
Cast to tuples for all uids explicitly
parent
3f1bc37143
commit
93a83eab1c
|
@ -317,7 +317,7 @@ class Actor:
|
||||||
# TODO: consider making this a dynamically defined
|
# TODO: consider making this a dynamically defined
|
||||||
# @dataclass once we get py3.7
|
# @dataclass once we get py3.7
|
||||||
self.loglevel = loglevel
|
self.loglevel = loglevel
|
||||||
self._arb_addr = arbiter_addr
|
self._arb_addr = tuple(arbiter_addr) if arbiter_addr is not None else None
|
||||||
|
|
||||||
# marked by the process spawning backend at startup
|
# marked by the process spawning backend at startup
|
||||||
# will be None for the parent most process started manually
|
# will be None for the parent most process started manually
|
||||||
|
@ -615,6 +615,7 @@ class Actor:
|
||||||
# ``scope = Nursery.start()``
|
# ``scope = Nursery.start()``
|
||||||
task_status.started(loop_cs)
|
task_status.started(loop_cs)
|
||||||
async for msg in chan:
|
async for msg in chan:
|
||||||
|
|
||||||
if msg is None: # loop terminate sentinel
|
if msg is None: # loop terminate sentinel
|
||||||
|
|
||||||
log.debug(
|
log.debug(
|
||||||
|
@ -1169,10 +1170,10 @@ class Actor:
|
||||||
parlance.
|
parlance.
|
||||||
"""
|
"""
|
||||||
await chan.send(self.uid)
|
await chan.send(self.uid)
|
||||||
uid: Tuple[str, str] = await chan.recv()
|
uid: Tuple[str, str] = tuple(await chan.recv())
|
||||||
|
|
||||||
if not isinstance(uid, tuple):
|
# if not isinstance(uid, tuple):
|
||||||
raise ValueError(f"{uid} is not a valid uid?!")
|
# raise ValueError(f"{uid} is not a valid uid?!")
|
||||||
|
|
||||||
chan.uid = uid
|
chan.uid = uid
|
||||||
log.runtime(f"Handshake with actor {uid}@{chan.raddr} complete")
|
log.runtime(f"Handshake with actor {uid}@{chan.raddr} complete")
|
||||||
|
@ -1239,8 +1240,9 @@ class Arbiter(Actor):
|
||||||
async def register_actor(
|
async def register_actor(
|
||||||
self, uid: Tuple[str, str], sockaddr: Tuple[str, int]
|
self, uid: Tuple[str, str], sockaddr: Tuple[str, int]
|
||||||
) -> None:
|
) -> None:
|
||||||
|
uid = tuple(uid)
|
||||||
name, uuid = uid
|
name, uuid = uid
|
||||||
self._registry[uid] = sockaddr
|
self._registry[uid] = tuple(sockaddr)
|
||||||
|
|
||||||
# pop and signal all waiter events
|
# pop and signal all waiter events
|
||||||
events = self._waiters.pop(name, ())
|
events = self._waiters.pop(name, ())
|
||||||
|
@ -1250,4 +1252,4 @@ class Arbiter(Actor):
|
||||||
event.set()
|
event.set()
|
||||||
|
|
||||||
async def unregister_actor(self, uid: Tuple[str, str]) -> None:
|
async def unregister_actor(self, uid: Tuple[str, str]) -> None:
|
||||||
self._registry.pop(uid)
|
self._registry.pop(tuple(uid))
|
||||||
|
|
Loading…
Reference in New Issue