From bbaba714659e40dd77afd4be12419665db680324 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 7 Mar 2022 17:47:45 -0500 Subject: [PATCH] Use new `tractor.query_actor()` for service checking --- piker/_daemon.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/piker/_daemon.py b/piker/_daemon.py index 1be79056..9bfeb2b8 100644 --- a/piker/_daemon.py +++ b/piker/_daemon.py @@ -296,16 +296,15 @@ class Brokerd: @acm async def find_service( service_name: str, +) -> Optional[tractor.Portal]: -) -> tractor.Portal: - - log.info(f'Scanning for existing {service_name}') + log.info(f'Scanning for service `{service_name}`') # attach to existing daemon by name if possible async with tractor.find_actor( service_name, arbiter_sockaddr=_registry_addr, - ) as portal: - yield portal + ) as maybe_portal: + yield maybe_portal async def check_for_service( @@ -316,8 +315,11 @@ async def check_for_service( Service daemon "liveness" predicate. ''' - async with find_service(service_name) as portal: - return portal is not None + async with tractor.query_actor( + service_name, + arbiter_sockaddr=_registry_addr, + ) as sockaddr: + return sockaddr @acm