File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,6 +75,10 @@ def open(self):
7575 # When temp_store is MEMORY (2) temporary tables and indices
7676 # are kept as if they were in pure in-memory databases.
7777 self .sql_connection .execute ("PRAGMA temp_store=MEMORY;" )
78+ # WAL size limit: cap at 10 MB. When approached, SQLite auto-checkpoints
79+ # even if other connections are active. Prevents unbounded WAL growth
80+ # on systems with multiple long-lived processes (backend, nginx, PHP-FPM).
81+ self .sql_connection .execute ("PRAGMA journal_size_limit=10000000;" )
7882
7983 self .sql_connection .text_factory = str
8084 self .sql_connection .row_factory = sqlite3 .Row
@@ -330,5 +334,6 @@ def get_temp_db_connection():
330334 conn = sqlite3 .connect (fullDbPath , timeout = 5 , isolation_level = None )
331335 conn .execute ("PRAGMA journal_mode=WAL;" )
332336 conn .execute ("PRAGMA busy_timeout=5000;" ) # 5s wait before giving up
337+ conn .execute ("PRAGMA journal_size_limit=10000000;" ) # 10 MB WAL cap with auto-checkpoint
333338 conn .row_factory = sqlite3 .Row
334339 return conn
You can’t perform that action at this time.
0 commit comments