From 46a1500aedb6ed89313a5cabb31c0c2a5f07cbea Mon Sep 17 00:00:00 2001 From: Amadeus Mader Date: Sat, 7 Mar 2026 18:49:34 +0100 Subject: [PATCH] fix(db): add busy_timeout to prevent SQLite database busy errors Configure SQLite busy_timeout PRAGMA to 5000ms so queries wait for locks to be released instead of failing immediately. This prevents Oban job queue from getting stuck with 'Database busy' errors during concurrent operations. --- Pinchflat_improvements.md | 2 +- config/config.exs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Pinchflat_improvements.md b/Pinchflat_improvements.md index f7facb5..a8a5488 100644 --- a/Pinchflat_improvements.md +++ b/Pinchflat_improvements.md @@ -73,7 +73,7 @@ SELECT source_id, metadata_filepath, fanart_filepath, poster_filepath, banner_fi - tvshow.nfo ``` -## Issue 4: SQLite "Database busy" errors blocking job processing +## Issue 4: SQLite "Database busy" errors blocking job processing [COMPLETED] **Problem:** The Oban job queue can get stuck with "Database busy" errors, preventing all indexing and download jobs from processing. This occurs when: diff --git a/config/config.exs b/config/config.exs index f57e0cc..2d2d6d0 100644 --- a/config/config.exs +++ b/config/config.exs @@ -32,7 +32,10 @@ config :pinchflat, config :pinchflat, Pinchflat.Repo, journal_mode: :wal, - pool_size: 5 + pool_size: 5, + # Set busy_timeout to 5 seconds to prevent "Database busy" errors during concurrent operations. + # Without this, queries fail immediately when the database is locked instead of waiting. + busy_timeout: 5000 # Configures the endpoint config :pinchflat, PinchflatWeb.Endpoint,