Skip to content

Commit

Permalink
Connect to SQLite using WAL mode
Browse files Browse the repository at this point in the history
Significantely speeds up all database requests and should solve the dreaded "database is currently locked" issue that shows up from time to time
  • Loading branch information
0x3dlux authored Nov 15, 2024
1 parent 0bbd8a1 commit 49ad9c3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions psa_car_controller/psacc/repository/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 49ad9c3

Please sign in to comment.