db improvements (#7227)

* Store camera labels in dict and other optimizations

* Add max on timeout so it is at least 60

* Ensure db timeout is at least 60

* Update list once a day to ensure new labels are cleaned up

* Formatting

* Insert recordings as bulk instead of individually.

* Fix

* Refactor event and timeline cleanup

* Remove unused
This commit is contained in:
Nicolas Mowen
2023-07-21 06:29:50 -06:00
committed by GitHub
parent b655eca152
commit bfa7a5cc60
6 changed files with 120 additions and 78 deletions

View File

@@ -313,7 +313,9 @@ class FrigateApp:
"cache_size": -512 * 1000, # 512MB of cache,
"synchronous": "NORMAL", # Safe when using WAL https://www.sqlite.org/pragma.html#pragma_synchronous
},
timeout=10 * len([c for c in self.config.cameras.values() if c.enabled]),
timeout=max(
60, 10 * len([c for c in self.config.cameras.values() if c.enabled])
),
)
models = [Event, Recordings, Timeline]
self.db.bind(models)