Skip to content

Commit

Permalink
Convert actor UIDs to hashable tuples
Browse files Browse the repository at this point in the history
`msgspec` sends python lists over the wire
(jcrist/msgspec#30) which is fine and dandy
but we use them as lookup keys so we need to be sure we tuple-cast
first.
  • Loading branch information
goodboy committed Sep 5, 2021
1 parent fa6d9be commit 7f89f9a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tractor/_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,8 @@ async def _from_parent(
# XXX: msgspec doesn't support serializing tuples
# so just cash manually here since it's what our
# internals expect.
address: Tuple[str, int] = value
self._arb_addr = value
address: Tuple[str, int] = tuple(value)
self._arb_addr = address

else:
setattr(self, attr, value)
Expand Down Expand Up @@ -1181,7 +1181,7 @@ async def _do_handshake(
parlance.
"""
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):
raise ValueError(f"{uid} is not a valid uid?!")
Expand Down Expand Up @@ -1254,7 +1254,7 @@ async def register_actor(
sockaddr: Tuple[str, str]

) -> None:
name, uuid = tuple(uid)
name, uuid = uid = tuple(uid)
self._registry[uid] = tuple(sockaddr)

# pop and signal all waiter events
Expand Down

0 comments on commit 7f89f9a

Please sign in to comment.