diff --git a/piker/tsp/_history.py b/piker/tsp/_history.py index 0edfaf2e..aa332fec 100644 --- a/piker/tsp/_history.py +++ b/piker/tsp/_history.py @@ -251,10 +251,20 @@ async def maybe_fill_null_segments( end_dt=end_dt, ) + if array.size == 0: + log.warning( + f'Valid gap from backend ??\n' + f'{end_dt} -> {start_dt}\n' + ) + # ?TODO? do we want to remove the nulls and push + # the close price here for the gap duration? + await tractor.pause() + break + if ( - frame_start_dt := ( - from_timestamp(array['time'][0]) - ) < backfill_until_dt + frame_start_dt := (from_timestamp(array['time'][0])) + < + backfill_until_dt ): log.error( f'Invalid frame_start !?\n' @@ -616,10 +626,17 @@ async def start_backfill( else: log.warning( - '0 BARS TO PUSH after diff!?\n' + f'0 BARS TO PUSH after diff!?\n' f'{next_start_dt} -> {last_start_dt}' + f'\n' + f'This might mean we rxed a gap frame which starts BEFORE,\n' + f'backfill_until_dt: {backfill_until_dt}\n' + f'end_dt_param: {end_dt_param}\n' + ) - await tractor.pause() + # XXX, to debug it and be sure. + # await tractor.pause() + break # Check if we're about to exceed buffer capacity BEFORE # attempting the push