RFC - Add a 3rd state to the HA shutdown sequence for writing… (#33358)

* add third stage to hass shutdown

* use 3rd stage in storage

* update core state

* add writing data to multi stop ignore

* update core test

* review comment

* update name based on feedback
This commit is contained in:
David F. Mulcahey authored and GitHub committed 2020-03-30 10:18:39 -07:00
1 parent 01bf4daf37
commit bcd1eb952c
6 files changed
+27 -8

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ import logging
import os
from typing import Any, Callable, Dict, List, Optional, Type, Union
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.const import EVENT_HOMEASSISTANT_FINAL_WRITE
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
from homeassistant.helpers.event import async_call_later
from homeassistant.loader import bind_hass
@@ -153,7 +153,7 @@ class Store:
"""Ensure that we write if we quit before delay has passed."""
if self._unsub_stop_listener is None:
self._unsub_stop_listener = self.hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, self._async_callback_stop_write
EVENT_HOMEASSISTANT_FINAL_WRITE, self._async_callback_stop_write
)
@callback