From 3a3816307e5fe8cd67bf8c6425248f17e972e49a Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 21 Mar 2026 19:46:22 +1100 Subject: [PATCH] Make WAL mode configurable for sqlite (#11585) --- docs/docs/start/config.md | 1 + src/backend/InvenTree/InvenTree/setting/db_backend.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/docs/start/config.md b/docs/docs/start/config.md index 7c9775f5f2..09f3c068bd 100644 --- a/docs/docs/start/config.md +++ b/docs/docs/start/config.md @@ -297,6 +297,7 @@ If running with a SQLite database backend, the following additional options are | Environment Variable | Configuration File | Description | Default | | --- | --- | --- | --- | | INVENTREE_DB_TIMEOUT | database.timeout | Database connection timeout (s) | 10 | +| INVENTREE_DB_WAL_MODE | database.wal_mode | Enable Write-Ahead Logging (WAL) mode for SQLite databases | True | ## Caching diff --git a/src/backend/InvenTree/InvenTree/setting/db_backend.py b/src/backend/InvenTree/InvenTree/setting/db_backend.py index cffdb93673..af523ef41a 100644 --- a/src/backend/InvenTree/InvenTree/setting/db_backend.py +++ b/src/backend/InvenTree/InvenTree/setting/db_backend.py @@ -148,5 +148,6 @@ def set_sqlite_options(db_options: dict): # not possible to implement any lower isolation levels in SQLite. # https://www.sqlite.org/isolation.html - # Specify that we want to use Write-Ahead Logging (WAL) mode for SQLite databases, as this allows for better concurrency and performance - db_options['init_command'] = 'PRAGMA journal_mode=WAL;' + if get_boolean_setting('INVENTREE_DB_WAL_MODE', 'database.wal_mode', True): + # Specify that we want to use Write-Ahead Logging (WAL) mode for SQLite databases, as this allows for better concurrency and performance + db_options['init_command'] = 'PRAGMA journal_mode=WAL;'