From 7ddba4fc592ba4d385c4cb4da3e9558918bcfa9e Mon Sep 17 00:00:00 2001 From: Craig Citro Date: Sat, 26 Jun 2021 18:41:26 -0500 Subject: [PATCH] Prevent repeated db connect calls Only call database.connect() if database.is_closed() Prevents errors if _db_connect is triggered twice --- frigate/http.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frigate/http.py b/frigate/http.py index da64e9ef8..75e00b26c 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -47,7 +47,8 @@ def create_app( @app.before_request def _db_connect(): - database.connect() + if database.is_closed(): + database.connect() @app.teardown_request def _db_close(exc):