Use `.service.find_service()` instead of of `tractor.find_actor()` in pape-eng

distribute_dis
Tyler Goodlet 2023-10-01 16:10:37 -04:00
parent e139d2e259
commit 653348fcd8
1 changed files with 5 additions and 2 deletions

View File

@ -39,6 +39,7 @@ import trio
import tractor
from piker.brokers import get_brokermod
from piker.service import find_service
from piker.accounting import (
Account,
MktPair,
@ -754,7 +755,7 @@ async def open_paperboi(
service_name = f'paperboi.{broker}'
async with (
tractor.find_actor(service_name) as portal,
find_service(service_name) as portal,
tractor.open_nursery() as an,
):
# NOTE: only spawn if no paperboi already is up since we likely
@ -777,8 +778,10 @@ async def open_paperboi(
) as (ctx, first):
yield ctx, first
# tear down connection and any spawned actor on exit
# ALWAYS tear down connection AND any newly spawned
# paperboi actor on exit!
await ctx.cancel()
if we_spawned:
await portal.cancel_actor()