mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Chunk timeline deletes (#12900)
This commit is contained in:
parent
3428baa3fa
commit
347d54f388
@ -194,8 +194,12 @@ class EventCleanup(threading.Thread):
|
|||||||
events_with_expired_clips = self.expire(EventCleanupType.clips)
|
events_with_expired_clips = self.expire(EventCleanupType.clips)
|
||||||
|
|
||||||
# delete timeline entries for events that have expired recordings
|
# delete timeline entries for events that have expired recordings
|
||||||
|
# delete up to 100,000 at a time
|
||||||
|
max_deletes = 100000
|
||||||
|
deleted_events_list = list(events_with_expired_clips)
|
||||||
|
for i in range(0, len(deleted_events_list), max_deletes):
|
||||||
Timeline.delete().where(
|
Timeline.delete().where(
|
||||||
Timeline.source_id << events_with_expired_clips
|
Timeline.source_id << deleted_events_list[i : i + max_deletes]
|
||||||
).execute()
|
).execute()
|
||||||
|
|
||||||
self.expire(EventCleanupType.snapshots)
|
self.expire(EventCleanupType.snapshots)
|
||||||
|
Loading…
Reference in New Issue
Block a user