Use early return instead of branching for remote emsd spawning
parent
fb996bfffb
commit
38471b7b34
|
@ -174,15 +174,13 @@ async def maybe_open_emsd(
|
||||||
async with tractor.find_actor('emsd') as portal:
|
async with tractor.find_actor('emsd') as portal:
|
||||||
if portal is not None:
|
if portal is not None:
|
||||||
yield portal
|
yield portal
|
||||||
|
return
|
||||||
|
|
||||||
else:
|
|
||||||
# ask remote daemon tree to spawn it
|
# ask remote daemon tree to spawn it
|
||||||
from .._daemon import spawn_emsd
|
from .._daemon import spawn_emsd
|
||||||
|
|
||||||
async with tractor.find_actor('pikerd') as portal:
|
async with tractor.find_actor('pikerd') as portal:
|
||||||
|
assert portal
|
||||||
if portal is not None:
|
|
||||||
|
|
||||||
name = await portal.run(
|
name = await portal.run(
|
||||||
spawn_emsd,
|
spawn_emsd,
|
||||||
brokername=brokername,
|
brokername=brokername,
|
||||||
|
@ -192,6 +190,7 @@ async def maybe_open_emsd(
|
||||||
yield portal
|
yield portal
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
async def open_ems(
|
async def open_ems(
|
||||||
broker: str,
|
broker: str,
|
||||||
|
|
Loading…
Reference in New Issue