mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Don't write storage to disk while stopping (#33456)
* Don't write storage to disk while stopping * rework change * lint * remove delay save and schedule final write at stop * update tests * fix test component using private methods * cleanup * always listen * use stop in restore state again * whitelist JSON exceptions for later * review comment * make zwave tests use mock storage
This commit is contained in:
committed by
GitHub
parent
9fd0192441
commit
8b0a0ee521
@@ -4,10 +4,7 @@ from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import Any, Awaitable, Dict, List, Optional, Set, cast
|
||||
|
||||
from homeassistant.const import (
|
||||
EVENT_HOMEASSISTANT_FINAL_WRITE,
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
)
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import (
|
||||
CoreState,
|
||||
HomeAssistant,
|
||||
@@ -187,9 +184,7 @@ class RestoreStateData:
|
||||
async_track_time_interval(self.hass, _async_dump_states, STATE_DUMP_INTERVAL)
|
||||
|
||||
# Dump states when stopping hass
|
||||
self.hass.bus.async_listen_once(
|
||||
EVENT_HOMEASSISTANT_FINAL_WRITE, _async_dump_states
|
||||
)
|
||||
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_dump_states)
|
||||
|
||||
@callback
|
||||
def async_restore_entity_added(self, entity_id: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user