diff --git a/piker/tsp/__init__.py b/piker/tsp/__init__.py index 7e0b4953..9c80bfae 100644 --- a/piker/tsp/__init__.py +++ b/piker/tsp/__init__.py @@ -434,21 +434,32 @@ async def start_backfill( # - some other unknown error (ib blocking the # history bc they don't want you seeing how they # cucked all the tinas..) - if dur := frame_types.get(timeframe): - # decrement by a frame's worth of duration and - # retry a few times. - last_start_dt.subtract( + if ( + frame_types + and + (dur := frame_types.get(timeframe)) + ): + # decrement by a duration's (frame) worth of time + # as maybe indicated by the backend to see if we + # can get older data before this possible + # "history gap". + orig_last_start_dt = last_start_dt + last_start_dt = last_start_dt.subtract( seconds=dur.total_seconds() ) log.warning( f'{mod.name} -> EMPTY FRAME for end_dt?\n' f'tf@fqme: {timeframe}@{mkt.fqme}\n' - 'bf_until <- last_start_dt:\n' - f'{backfill_until_dt} <- {last_start_dt}\n' - f'Decrementing `end_dt` by {dur} and retry..\n' + f'Decrementing `end_dt` by {dur} and retry..\n\n' + + f'orig_last_start_dt: {orig_last_start_dt}\n' + f'dur subtracted last_start_dt: {last_start_dt}\n' + f'bf_until: {backfill_until_dt}\n' ) continue + raise + # broker says there never was or is no more history to pull except DataUnavailable: log.warning(