From df16726211fe1c0a12cd4a03e55b3108db52924a Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 28 Oct 2022 15:55:04 -0400 Subject: [PATCH] Just wipe wrong timeframe filled tsdb colseries for now --- piker/data/marketstore.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/piker/data/marketstore.py b/piker/data/marketstore.py index 6a8acdfb..3edc1718 100644 --- a/piker/data/marketstore.py +++ b/piker/data/marketstore.py @@ -469,13 +469,21 @@ class Storage: time_step = time[-1] - time[-2] ts = tf_in_1s.inverse[data_set.timeframe] - assert time_step == ts + if time_step != ts: + log.warning( + f'MKTS BUG: wrong timeframe loaded: {time_step}' + 'YOUR DATABASE LIKELY CONTAINS BAD DATA FROM AN OLD BUG' + f'WIPING HISTORY FOR {ts}s' + ) + await self.delete_ts(fqsn, timeframe) - # if time_step != ts: - # log.warning(f'MKTS BUG: wrong timeframe loaded: {time_step}') - # if timeframe == 1: - # await tractor.breakpoint() - # return {} + # try reading again.. + return await self.read_ohlcv( + fqsn, + timeframe, + end, + limit, + ) return array