Explorar el Código

Prevent repeated db connect calls

Only call database.connect() if database.is_closed()
Prevents errors if _db_connect is triggered twice
Craig Citro hace 3 años
padre
commit
7ddba4fc59
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      frigate/http.py

+ 2 - 1
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):