From 14c5fc24ecaad737edb14b34aa6f744b7d345d69 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 29 Mar 2021 08:34:56 -0400 Subject: [PATCH] Port to new setup routine name --- piker/_daemon.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/piker/_daemon.py b/piker/_daemon.py index 72e390f2..80175ae4 100644 --- a/piker/_daemon.py +++ b/piker/_daemon.py @@ -134,6 +134,8 @@ async def spawn_brokerd( **tractor_kwargs ) -> tractor._portal.Portal: + from .data import _setup_persistent_brokerd + log.info(f'Spawning {brokername} broker daemon') brokermod = get_brokermod(brokername) @@ -152,6 +154,21 @@ async def spawn_brokerd( **tractor_kwargs ) + # TODO: so i think this is the perfect use case for supporting + # a cross-actor async context manager api instead of this + # shoort-and-forget task spawned in the root nursery, we'd have an + # async exit stack that we'd register the `portal.open_context()` + # call with and then have the ability to unwind the call whenevs. + + # non-blocking setup of brokerd service nursery + _services.service_n.start_soon( + partial( + portal.run, + _setup_persistent_brokerd, + brokername=brokername, + ) + ) + return dname