fix: Guard timeframe validation loop against empty list

Return early from `_build_ohlcv_dl_jobs` if `pair_list` is empty.
This prevents unconditional access to `self.timeframes` (which was introduced by the optimization), ensuring that tests or scenarios with uninitialized/mocked exchanges and empty pair lists do not crash.

Co-authored-by: Corax-CoLAB <239841157+Corax-CoLAB@users.noreply.github.com>
pull/12809/head
google-labs-jules[bot] 3 weeks ago
parent 12b5d81cc1
commit fe199a46ed

@ -2732,6 +2732,9 @@ class Exchange:
"""
input_coroutines: list[Coroutine[Any, Any, OHLCVResponse]] = []
cached_pairs = []
if not pair_list:
return input_coroutines, cached_pairs
# optimization: cache timeframes as a set outside the loop to avoid repeated property access
# and linear search
available_timeframes = set(self.timeframes)

Loading…
Cancel
Save