Load pending state attributes and event data ids at startup (#88444)

* Load pending state attributes and event data ids at startup

Since we queue all events to be processed after startup
we can have a thundering herd of queries to prime the
LRUs of event data and state attributes ids. Since we
know we are about to process a chunk of events we can
fetch all the ids in two queries

* lru

* fix hang

* Fix recorder LRU being destroyed if event session is reopened

We would clear the LRU in _close_event_session but
it would never get replaced with an LRU again so
it would leak memory if the event session is reopened

* Fix recorder LRU being destroyed if event session is reopened

We would clear the LRU in _close_event_session but
it would never get replaced with an LRU again so
it would leak memory if the event session is reopened

* cleanup
This commit is contained in:
J. Nick Koston
2023-02-19 20:26:38 -06:00
committed by GitHub
parent c4f92f5ad4
commit c2b770bcb9
9 changed files with 190 additions and 74 deletions

View File

@@ -27,7 +27,7 @@ MAX_QUEUE_BACKLOG = 65000
# in https://github.com/sqlite/sqlite/commit/efdba1a8b3c6c967e7fae9c1989c40d420ce64cc
# We can increase this back to 1000 once most
# have upgraded their sqlite version
MAX_ROWS_TO_PURGE = 998
SQLITE_MAX_BIND_VARS = 998
DB_WORKER_PREFIX = "DbWorker"