From 49ad9c30f2739c56b0ecbc0b813ae468afa0b2d4 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 15 Nov 2024 16:44:25 +0100 Subject: [PATCH] Connect to SQLite using WAL mode Significantely speeds up all database requests and should solve the dreaded "database is currently locked" issue that shows up from time to time --- psa_car_controller/psacc/repository/db.py | 1 + 1 file changed, 1 insertion(+) diff --git a/psa_car_controller/psacc/repository/db.py b/psa_car_controller/psacc/repository/db.py index 4dd0c038..7009e41b 100644 --- a/psa_car_controller/psacc/repository/db.py +++ b/psa_car_controller/psacc/repository/db.py @@ -40,6 +40,7 @@ class CustomSqliteConnection(sqlite3.Connection): def __init__(self, *args, **kwargs): # real signature unknown super().__init__(*args, **kwargs) self.callbacks = [] + self.execute("PRAGMA journal_mode=WAL;") def execute_callbacks(self): for callback in self.callbacks: