forked from goodboy/tractor
				
			Convert actor UIDs to hashable tuples
`msgspec` sends python lists over the wire (https://github.com/jcrist/msgspec/issues/30) which is fine and dandy but we use them as lookup keys so we need to be sure we tuple-cast first.msgspec_infect_asyncio
							parent
							
								
									fa6d9bef52
								
							
						
					
					
						commit
						c27b00687c
					
				|  | @ -318,7 +318,7 @@ class Actor: | ||||||
|         # @dataclass once we get py3.7 |         # @dataclass once we get py3.7 | ||||||
|         self.loglevel = loglevel |         self.loglevel = loglevel | ||||||
| 
 | 
 | ||||||
|         self._arb_addr = arbiter_addr or (None, None) |         self._arb_addr = arbiter_addr | ||||||
| 
 | 
 | ||||||
|         # 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 | ||||||
|  | @ -797,8 +797,8 @@ class Actor: | ||||||
|                         # XXX: msgspec doesn't support serializing tuples |                         # XXX: msgspec doesn't support serializing tuples | ||||||
|                         # so just cash manually here since it's what our |                         # so just cash manually here since it's what our | ||||||
|                         # internals expect. |                         # internals expect. | ||||||
|                         address: Tuple[str, int] = value |                         address: Tuple[str, int] = tuple(value) | ||||||
|                         self._arb_addr = value |                         self._arb_addr = address | ||||||
| 
 | 
 | ||||||
|                     else: |                     else: | ||||||
|                         setattr(self, attr, value) |                         setattr(self, attr, value) | ||||||
|  | @ -1181,7 +1181,7 @@ 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?!") | ||||||
|  | @ -1254,7 +1254,7 @@ class Arbiter(Actor): | ||||||
|         sockaddr: Tuple[str, str] |         sockaddr: Tuple[str, str] | ||||||
| 
 | 
 | ||||||
|     ) -> None: |     ) -> None: | ||||||
|         name, uuid = tuple(uid) |         name, uuid = uid = tuple(uid) | ||||||
|         self._registry[uid] = tuple(sockaddr) |         self._registry[uid] = tuple(sockaddr) | ||||||
| 
 | 
 | ||||||
|         # pop and signal all waiter events |         # pop and signal all waiter events | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue