From 4e5b29b6afc19a0c380d60c6c00c2cb5c7d0f0c6 Mon Sep 17 00:00:00 2001 From: bloodearnest Date: Wed, 8 May 2024 15:47:41 +0100 Subject: [PATCH] Enforce wal mode We've already enabled this in production, but this ensures dev is wal mode also --- jobrunner/cli/manifests.py | 2 +- jobrunner/lib/database.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/jobrunner/cli/manifests.py b/jobrunner/cli/manifests.py index 95c0993a..e0b2ed85 100644 --- a/jobrunner/cli/manifests.py +++ b/jobrunner/cli/manifests.py @@ -21,7 +21,7 @@ def main(): workspace_dir = local.get_high_privacy_workspace(workspace) if not workspace_dir.exists(): - print(f" - workspace is archived") + print(f" - workspace {workspace} is archived") continue level4_dir = local.get_medium_privacy_workspace(workspace) diff --git a/jobrunner/lib/database.py b/jobrunner/lib/database.py index 8703b620..45f81a5b 100644 --- a/jobrunner/lib/database.py +++ b/jobrunner/lib/database.py @@ -177,6 +177,12 @@ def get_connection(filename=None): conn.row_factory = sqlite3.Row cache[filename] = conn + # use WAL to enable other processes (e.g. operational tasks) to read the DB. + # job-runner should be the only active writer, which means if we need + # some other process to write the db (e.g. a backfill), then we should + # stop job-runner. + conn.execute("PRAGMA journal_mode=WAL") + return cache[filename]