From cc026dfb1d4b4aad9e44ee2de14ffcc88f6b851e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 11 Mar 2022 16:49:37 -0500 Subject: [PATCH] Open feeds using `Portal.open_context()` --- piker/data/feed.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/piker/data/feed.py b/piker/data/feed.py index e2e91d7b..611d79ce 100644 --- a/piker/data/feed.py +++ b/piker/data/feed.py @@ -519,19 +519,20 @@ async def open_sample_step_stream( # created for all practical purposes async with maybe_open_context( acm_func=partial( - portal.open_stream_from, + portal.open_context, iter_ohlc_periods, ), kwargs={'delay_s': delay_s}, - ) as (cache_hit, istream): - if cache_hit: - # add a new broadcast subscription for the quote stream - # if this feed is likely already in use - async with istream.subscribe() as bistream: - yield bistream - else: - yield istream + ) as (cache_hit, (ctx, first)): + async with ctx.open_stream() as istream: + if cache_hit: + # add a new broadcast subscription for the quote stream + # if this feed is likely already in use + async with istream.subscribe() as bistream: + yield bistream + else: + yield istream @dataclass