mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-05-28 18:43:40 +00:00
_cleanup_dead_intervals() compacts group["intervals"] in-place after removing dead (touched) intervals. Surviving intervals shift to new positions, but the timestamp index was not updated to reflect this. _remove_empty_groups() only rebuilds the index when groups become completely empty. For partially-compacted groups (some dead intervals removed but group still has living intervals), no rebuild happened. This left stale interval_index values that point past the end of the compacted list, causing IndexError in _get_cached_intervals. Fix: after _remove_empty_groups, if dead intervals were cleaned but no groups became empty, explicitly rebuild the index so positions reflect the compacted group["intervals"] lists. Adds regression test reproducing the exact partial-touch scenario that triggers stale index entries after in-place compaction. Fixes #118 Impact: Brand-new Tibber users can now set up the integration without getting "Failed setup, will retry: list index out of range". |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| cache.py | ||
| fetcher.py | ||
| garbage_collector.py | ||
| index.py | ||
| manager.py | ||
| routing.py | ||
| storage.py | ||