From 0d537f108efaae325c4f8904b3f971376da13117 Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 13 Dec 2019 12:47:56 +0100 Subject: [PATCH] Lower timeout for a DB connection from 30s to 10s --- resources/lib/db.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/lib/db.py b/resources/lib/db.py index 53db56c7..28ffc7c7 100644 --- a/resources/lib/db.py +++ b/resources/lib/db.py @@ -6,6 +6,7 @@ from functools import wraps from . import variables as v, app DB_WRITE_ATTEMPTS = 100 +DB_CONNECTION_TIMEOUT = 10 class LockedDatabase(Exception): @@ -78,7 +79,9 @@ def connect(media_type=None): db_path = v.DB_TEXTURE_PATH else: db_path = v.DB_VIDEO_PATH - conn = sqlite3.connect(db_path, timeout=30.0, isolation_level=None) + conn = sqlite3.connect(db_path, + timeout=DB_CONNECTION_TIMEOUT, + isolation_level=None) attempts = DB_WRITE_ATTEMPTS while True: try: