From 5250dbc3aeeca4c5613a17e9d79f2e6dc67b64a6 Mon Sep 17 00:00:00 2001 From: type-two Date: Wed, 26 Aug 2026 10:31:10 +1000 Subject: [PATCH] fix: tolerate losing the WAL-switch race (pragma needs exclusive lock) Co-Authored-By: Claude Fable 5 --- bin/vg-index | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/vg-index b/bin/vg-index index 1e321ce..796cae8 100755 --- a/bin/vg-index +++ b/bin/vg-index @@ -36,7 +36,10 @@ def open_db(): LIB.mkdir(parents=True, exist_ok=True) THUMBS.mkdir(parents=True, exist_ok=True) db = sqlite3.connect(DB, timeout=60) - db.execute("PRAGMA journal_mode=WAL") # concurrent index jobs on one node + try: # WAL is persistent once set; the switch itself needs an exclusive + db.execute("PRAGMA journal_mode=WAL") # lock, so tolerate losing the race + except sqlite3.OperationalError: + pass db.executescript(""" CREATE TABLE IF NOT EXISTS videos( id INTEGER PRIMARY KEY, path TEXT UNIQUE, mtime REAL, duration REAL,