update_manager: Prune stale data in the database

SIgned-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-12-04 07:54:18 -05:00
parent 3203950ca9
commit e8c1798a13
1 changed files with 8 additions and 0 deletions

View File

@ -128,6 +128,14 @@ class UpdateManager:
raise config.error(
f"Invalid type '{client_type}' for section [{section}]")
# Prune stale data from the database
umdb = self.cmd_helper.get_umdb()
db_keys = umdb.keys()
for key in db_keys:
if key not in self.updaters:
logging.info(f"Removing stale update_manager data: {key}")
umdb.pop(key, None)
self.cmd_request_lock = asyncio.Lock()
self.klippy_identified_evt: Optional[asyncio.Event] = None