fix: tolerate losing the WAL-switch race (pragma needs exclusive lock)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
47412ca4b7
commit
5250dbc3ae
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user