Remove use of `tractor.run()`

chart_trader
Tyler Goodlet 2020-12-28 13:07:17 -05:00
parent d7f80d8ddb
commit 5d30f351af
2 changed files with 13 additions and 15 deletions

View File

@ -159,20 +159,20 @@ def run_qtractor(
'main': instance, 'main': instance,
} }
# setup tractor entry point args # define tractor entrypoint
main = partial( async def main():
tractor._main,
async_fn=func, async with tractor.open_root_actor(
args=args + (widgets,),
arbiter_addr=( arbiter_addr=(
tractor._default_arbiter_host, tractor._root._default_arbiter_host,
tractor._default_arbiter_port, tractor._root._default_arbiter_port,
), ),
name='qtractor', name='qtractor',
**tractor_kwargs, **tractor_kwargs,
) ) as a:
await func(*(args + (widgets,)))
# guest mode # guest mode entry
trio.lowlevel.start_guest_run( trio.lowlevel.start_guest_run(
main, main,
run_sync_soon_threadsafe=run_sync_soon_threadsafe, run_sync_soon_threadsafe=run_sync_soon_threadsafe,

View File

@ -112,8 +112,6 @@ CHART_MARGINS = (0, 0, 2, 2)
_min_points_to_show = 6 _min_points_to_show = 6
_bars_from_right_in_follow_mode = int(6**2) _bars_from_right_in_follow_mode = int(6**2)
_bars_to_left_in_follow_mode = int(6**3) _bars_to_left_in_follow_mode = int(6**3)
_tina_mode = False _tina_mode = False