Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Clear queue and store data on unload #2413

Merged
merged 1 commit into from
Dec 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion custom_components/hacs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async def async_initialize_integration(
except BaseException: # lgtm [py/catch-base-exception] pylint: disable=broad-except
# If this happens, the users YAML is not valid, we assume YAML mode
pass
hacs.log.debug(f"Configuration type: {hacs.configuration.config_type}")
hacs.log.debug("Configuration type: %s", hacs.configuration.config_type)
hacs.core.config_path = hacs.hass.config.path()

if hacs.core.ha_version is None:
Expand Down Expand Up @@ -171,10 +171,16 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
"""Handle removal of an entry."""
hacs: HacsBase = hass.data[DOMAIN]

# Clear out pending queue
hacs.queue.clear()

for task in hacs.recuring_tasks:
# Cancel all pending tasks
task()

# Store data
await hacs.data.async_write()

try:
if hass.data.get("frontend_panels", {}).get("hacs"):
hacs.log.info("Removing sidepanel")
Expand Down