Test with `any(portals)` since `gather_contexts()` will return `list[None | tuple]`

multihomed
Tyler Goodlet 2023-11-06 15:43:43 -05:00
parent d651f3d8e9
commit 227c9ea173
1 changed files with 6 additions and 2 deletions

View File

@ -211,10 +211,14 @@ async def find_actor(
# 'Gathered portals:\n' # 'Gathered portals:\n'
# f'{portals}' # f'{portals}'
# ) # )
if not portals: # NOTE: `gather_contexts()` will return a
# `tuple[None, None, ..., None]` if no contact
# can be made with any regstrar at any of the
# N provided addrs!
if not any(portals):
if raise_on_none: if raise_on_none:
raise RuntimeError( raise RuntimeError(
f'No {name} found registered @ {registry_addrs}' f'No actor "{name}" found registered @ {registry_addrs}'
) )
yield None yield None
return return