From 040d447145b7f5bc4bf657f6fd1e46b3f3cbfd69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Mon, 4 Sep 2023 15:52:08 +0200 Subject: [PATCH] Change SQLite config to avoid locking --- src/common/db/Database.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/db/Database.py b/src/common/db/Database.py index aae43b994..5bc48384e 100644 --- a/src/common/db/Database.py +++ b/src/common/db/Database.py @@ -166,6 +166,11 @@ class Database: bind=self.__sql_engine, autoflush=False, expire_on_commit=False ) self.suffix_rx = re_compile(r"_\d+$") + + if sqlalchemy_string.startswith("sqlite"): + with self.__db_session() as session: + session.execute(text("PRAGMA journal_mode=WAL")) + session.commit() def __del__(self) -> None: """Close the database"""