From e95589e5b070ccdc8112c2c611a713f463b495a6 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 5 Sep 2021 12:50:15 -0400 Subject: [PATCH] Ignore ohlc step stream subs lookup errors --- piker/data/_sampling.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/piker/data/_sampling.py b/piker/data/_sampling.py index 4085571b..4c5aaded 100644 --- a/piker/data/_sampling.py +++ b/piker/data/_sampling.py @@ -151,7 +151,12 @@ async def iter_ohlc_periods( # stream and block until cancelled await trio.sleep_forever() finally: - subs.remove(ctx) + try: + subs.remove(ctx) + except ValueError: + log.error( + f'iOHLC step stream was already dropped for {ctx.chan.uid}?' + ) async def sample_and_broadcast( @@ -244,7 +249,7 @@ async def sample_and_broadcast( await stream.send(quote) else: - await stream.send({sym: quote}) + await stream.send({sym: quote}) if cs.cancelled_caught: lags += 1