From cbc98c5b46988eb8e72b1ff3523554e37cafd0df Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sun, 22 Sep 2024 11:13:36 -0500 Subject: [PATCH] delete only existing ids in event cleanup --- frigate/events/cleanup.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frigate/events/cleanup.py b/frigate/events/cleanup.py index e4c571be7..5f121a92b 100644 --- a/frigate/events/cleanup.py +++ b/frigate/events/cleanup.py @@ -230,7 +230,12 @@ class EventCleanup(threading.Thread): Event.delete().where(Event.id << chunk).execute() if self.config.semantic_search.enabled: - self.embeddings.thumbnail.delete(ids=chunk) - self.embeddings.description.delete(ids=chunk) + for collection in [ + self.embeddings.thumbnail, + self.embeddings.description, + ]: + existing_ids = collection.get(ids=chunk, include=[])["ids"] + if existing_ids: + collection.delete(ids=existing_ids) logger.info("Exiting event cleanup...")