Use early return instead of branching for remote emsd spawning

supervise
Tyler Goodlet 2021-03-22 09:52:22 -04:00
parent fb996bfffb
commit 38471b7b34
1 changed files with 11 additions and 12 deletions

View File

@ -174,15 +174,13 @@ async def maybe_open_emsd(
async with tractor.find_actor('emsd') as portal:
if portal is not None:
yield portal
return
else:
# ask remote daemon tree to spawn it
from .._daemon import spawn_emsd
async with tractor.find_actor('pikerd') as portal:
if portal is not None:
assert portal
name = await portal.run(
spawn_emsd,
brokername=brokername,
@ -192,6 +190,7 @@ async def maybe_open_emsd(
yield portal
@asynccontextmanager
async def open_ems(
broker: str,