1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Fix delayed registry check to only using the short delay at running (#113471)

This commit is contained in:
J. Nick Koston
2024-03-14 15:11:09 -10:00
committed by GitHub
parent 052d7d1e19
commit 3528cc86d7
2 changed files with 26 additions and 9 deletions

View File

@@ -11,7 +11,7 @@ if TYPE_CHECKING:
from .storage import Store
SAVE_DELAY = 10
SAVE_DELAY_STARTING = 300
SAVE_DELAY_LONG = 180
class BaseRegistry(ABC):
@@ -25,9 +25,7 @@ class BaseRegistry(ABC):
"""Schedule saving the registry."""
# Schedule the save past startup to avoid writing
# the file while the system is starting.
delay = (
SAVE_DELAY_STARTING if self.hass.state is CoreState.starting else SAVE_DELAY
)
delay = SAVE_DELAY if self.hass.state is CoreState.running else SAVE_DELAY_LONG
self._store.async_delay_save(self._data_to_save, delay)
@callback