fix flaky sqlite test contention
All checks were successful
deploy / deploy (push) Successful in 41s

Increase DBConnection queue tolerance to stop requests being dropped
under load, and flip 3 write-heavy test files to async: false since
SQLite's single-writer model doesn't play well with concurrent writes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey 2026-02-20 22:54:12 +00:00
parent b06029079d
commit eb65b11e4d
4 changed files with 6 additions and 4 deletions

View File

@ -13,7 +13,9 @@ config :berrypod, Berrypod.Repo,
pool_size: 1, pool_size: 1,
pool: Ecto.Adapters.SQL.Sandbox, pool: Ecto.Adapters.SQL.Sandbox,
journal_mode: :wal, journal_mode: :wal,
busy_timeout: 10_000 busy_timeout: 15_000,
queue_target: 5_000,
queue_interval: 10_000
# We don't run a server during test. If one is required, # We don't run a server during test. If one is required,
# you can enable the server option below. # you can enable the server option below.

View File

@ -1,5 +1,5 @@
defmodule Berrypod.MediaTest do defmodule Berrypod.MediaTest do
use Berrypod.DataCase, async: true use Berrypod.DataCase, async: false
alias Berrypod.Media alias Berrypod.Media

View File

@ -1,5 +1,5 @@
defmodule Berrypod.Orders.OrderNotifierTest do defmodule Berrypod.Orders.OrderNotifierTest do
use Berrypod.DataCase, async: true use Berrypod.DataCase, async: false
import Swoosh.TestAssertions import Swoosh.TestAssertions
import Berrypod.OrdersFixtures import Berrypod.OrdersFixtures

View File

@ -1,5 +1,5 @@
defmodule Berrypod.Products.ProductTest do defmodule Berrypod.Products.ProductTest do
use Berrypod.DataCase, async: true use Berrypod.DataCase, async: false
alias Berrypod.Products.Product alias Berrypod.Products.Product