commit 7fcc3181451eab6babb3db11c4d22e8766034f1d
parent da8ba9bbfc15096709b26dc0be36231fde4ac63a
Author: Brian C. Lane <bcl@brianlane.com>
Date: Sun, 20 Mar 2022 10:00:02 -0700
Add cache pre-load and expiration to startup
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/strix/__init__.py b/src/strix/__init__.py
@@ -14,7 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from datetime import datetime, timedelta
import multiprocessing as mp
import os
import re
@@ -22,6 +21,7 @@ import time
from . import api
from . import cmdline
+from . import events
from . import queue
from . import logger
from . import motion
@@ -119,6 +119,13 @@ def run() -> bool:
ch.setLevel(logging.DEBUG)
log.addHandler(ch)
+ # Initialize Event Cache settings
+ events.EventCache.logger(log)
+ events.EventCache.base_dir(base_dir)
+ events.EventCache.keep(opts.keep_days)
+ events.EventCache.check_cache(opts.check_cache)
+ events.preload_cache(log, base_dir)
+
# Start queue monitor and processing thread (starts its own Multiprocessing threads)
queue_path = os.path.abspath(os.path.join(base_dir, "queue/"))
if not os.path.exists(queue_path):