Improve performance of fetching and storing history and events with the database (#84870)
This commit is contained in:
parent
0ad16e25ef
commit
b8a1537b58
26 changed files with 3696 additions and 281 deletions
|
@ -388,12 +388,14 @@ def _rows_match(row: Row | EventAsRow, other_row: Row | EventAsRow) -> bool:
|
|||
|
||||
def _row_time_fired_isoformat(row: Row | EventAsRow) -> str:
|
||||
"""Convert the row timed_fired to isoformat."""
|
||||
return process_timestamp_to_utc_isoformat(row.time_fired or dt_util.utcnow())
|
||||
return process_timestamp_to_utc_isoformat(
|
||||
dt_util.utc_from_timestamp(row.time_fired_ts) or dt_util.utcnow()
|
||||
)
|
||||
|
||||
|
||||
def _row_time_fired_timestamp(row: Row | EventAsRow) -> float:
|
||||
"""Convert the row timed_fired to timestamp."""
|
||||
return process_datetime_to_timestamp(row.time_fired or dt_util.utcnow())
|
||||
return row.time_fired_ts or process_datetime_to_timestamp(dt_util.utcnow())
|
||||
|
||||
|
||||
class EntityNameCache:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue