From 8159a312ae9fe1310b6bb28394cab0867ebaa6d6 Mon Sep 17 00:00:00 2001 From: jamey Date: Mon, 2 Mar 2026 11:13:31 +0000 Subject: [PATCH] increase sqlite busy_timeout and reduce image queue concurrency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps busy_timeout from 5s to 15s so Oban's internal writes can wait out CPU-heavy libvips processing. Also drops the images queue from 2 to 1 in prod — a single job with System.schedulers_online() internal parallelism is enough for shared-cpu-1x and still scales on bigger machines. Co-Authored-By: Claude Opus 4.6 --- config/runtime.exs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/runtime.exs b/config/runtime.exs index 27f4b13..f95a858 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -32,7 +32,7 @@ if config_env() == :prod do database: database_path, pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5"), journal_mode: :wal, - busy_timeout: 5000, + busy_timeout: 15_000, journal_size_limit: 67_108_864, default_transaction_mode: :immediate, custom_pragmas: [mmap_size: 134_217_728] @@ -109,6 +109,11 @@ if config_env() == :prod do tls: :if_available end + # On small machines (Fly shared-cpu-1x) running 2 concurrent image + # processing jobs saturates the CPU and causes SQLite locking. + # One job at a time with per-job parallelism is enough. + config :berrypod, Oban, queues: [default: 3, images: 1, sync: 1, checkout: 1, newsletter: 1] + # Stripe and Printify keys are stored encrypted in the database and loaded # at runtime by Berrypod.Secrets. No env vars needed for those. end