-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdiff_153.patch
More file actions
19 lines (17 loc) · 1.56 KB
/
Copy pathdiff_153.patch
File metadata and controls
19 lines (17 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/models/feedback_handler.py b/models/feedback_handler.py
index 5641cb8..ffa7888 100644
--- a/models/feedback_handler.py
+++ b/models/feedback_handler.py
@@ -22,6 +22,14 @@ def _get_connection(db_path: str) -> sqlite3.Connection:
_local.conn.row_factory = sqlite3.Row
_local.conn.execute("PRAGMA journal_mode=WAL")
_local.conn.execute("PRAGMA busy_timeout=5000")
+ else:
+ try:
+ _local.conn.execute("SELECT 1")
+ except sqlite3.Error:
+ _local.conn = sqlite3.connect(db_path, check_same_thread=False)
+ _local.conn.row_factory = sqlite3.Row
+ _local.conn.execute("PRAGMA journal_mode=WAL")
+ _local.conn.execute("PRAGMA busy_timeout=5000")
return _local.conn