From c877d67e0cabace8578feeb77103c0d572eee2ed Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Thu, 18 Feb 2021 02:31:42 -0500 Subject: [PATCH] check if pragma is already wal before setting --- archivebox/config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/archivebox/config.py b/archivebox/config.py index edbafc0f..33c92a38 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -1082,7 +1082,9 @@ def setup_django(out_dir: Path=None, check_db=False, config: ConfigDict=CONFIG, # Enable WAL mode in sqlite3 from django.db import connection with connection.cursor() as cursor: - cursor.execute("PRAGMA journal_mode=wal;") + current_mode = cursor.execute("PRAGMA journal_mode") + if current_mode != 'wal': + cursor.execute("PRAGMA journal_mode=wal;") # Create cache table in DB if needed try: