DB Optimizations (#6712)

* Enable auto vacuums

* Enable auto vacuum

* Fix separator

* Fix separator and remove incorrect log

* Limit to 1 row since that is all that is used

* Add index on camera + segment_size

* Formatting

* Increase timeout and cache_size

* Set DB mode to NORMAL synchronous level

* Formatting

* Vacuum every 2 weeks

* Remove fstring

* Use string

* Use consts
This commit is contained in:
Nicolas Mowen
2023-06-11 06:23:18 -06:00
committed by GitHub
parent 20b52a96bc
commit 8bc76d19db
5 changed files with 87 additions and 9 deletions

View File

@@ -180,7 +180,9 @@ class RecordingCleanup(threading.Thread):
# find all the recordings older than the oldest recording in the db
try:
oldest_recording = Recordings.select().order_by(Recordings.start_time).get()
oldest_recording = (
Recordings.select().order_by(Recordings.start_time).limit(1).get()
)
p = Path(oldest_recording.path)
oldest_timestamp = p.stat().st_mtime - 1