mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
fix UnboundLocalError on modified_statistic_ids in compile_statistics (#116795)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
f143ed9eeb
commit
ac12d2a463
@ -485,6 +485,12 @@ def compile_statistics(instance: Recorder, start: datetime, fire_events: bool) -
|
|||||||
|
|
||||||
The actual calculation is delegated to the platforms.
|
The actual calculation is delegated to the platforms.
|
||||||
"""
|
"""
|
||||||
|
# Define modified_statistic_ids outside of the "with" statement as
|
||||||
|
# _compile_statistics may raise and be trapped by
|
||||||
|
# filter_unique_constraint_integrity_error which would make
|
||||||
|
# modified_statistic_ids unbound.
|
||||||
|
modified_statistic_ids: set[str] | None = None
|
||||||
|
|
||||||
# Return if we already have 5-minute statistics for the requested period
|
# Return if we already have 5-minute statistics for the requested period
|
||||||
with session_scope(
|
with session_scope(
|
||||||
session=instance.get_session(),
|
session=instance.get_session(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user