mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-14 12:46:32 +00:00
Fix race condition when removing add-on (#5850)
When uninstalling an add-on, we schedule a task to reload the ingress tokens. This scheduled task typically ends up running right after clearing the add-on data with `self.sys_addons.data.uninstall(self)` (since this task is doing I/O, the race is rather deterministic). Let's make sure we reload the ingress tokens at the end. Also simply execute reloading synchrounsly since this is a rather quick operation and makes sure that errors would get attributed to the right add-on uninstall operation.
This commit is contained in:
parent
c1b45406d6
commit
bc9e3eb95b
@ -846,9 +846,10 @@ class Addon(AddonModel):
|
||||
await self.sys_ingress.update_hass_panel(self)
|
||||
|
||||
# Cleanup Ingress dynamic port assignment
|
||||
need_ingress_token_cleanup = False
|
||||
if self.with_ingress:
|
||||
need_ingress_token_cleanup = True
|
||||
await self.sys_ingress.del_dynamic_port(self.slug)
|
||||
self.sys_create_task(self.sys_ingress.reload())
|
||||
|
||||
# Cleanup discovery data
|
||||
for message in self.sys_discovery.list_messages:
|
||||
@ -863,8 +864,12 @@ class Addon(AddonModel):
|
||||
await service.del_service_data(self)
|
||||
|
||||
# Remove from addon manager
|
||||
await self.sys_addons.data.uninstall(self)
|
||||
self.sys_addons.local.pop(self.slug)
|
||||
await self.sys_addons.data.uninstall(self)
|
||||
|
||||
# Cleanup Ingress tokens
|
||||
if need_ingress_token_cleanup:
|
||||
await self.sys_ingress.reload()
|
||||
|
||||
@Job(
|
||||
name="addon_update",
|
||||
|
Loading…
x
Reference in New Issue
Block a user