From 67d77edb011db276d5ea17da062ae60f4cf4b5a1 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Sun, 23 Aug 2026 04:08:49 +1000 Subject: [PATCH] fix(gateway): back off ClaimTurn race retries The concurrent regression retried SQLITE_BUSY immediately, allowing the losing goroutine to exhaust all attempts before the winning transaction was scheduled to commit on GitHub Actions. Yield for one millisecond between bounded busy retries; non-busy errors still fail immediately and exhausted contention still fails the test. --- internal/gateway/session_store_sqlite_claimturn_race_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/gateway/session_store_sqlite_claimturn_race_test.go b/internal/gateway/session_store_sqlite_claimturn_race_test.go index 5d9d63138..e274213b9 100644 --- a/internal/gateway/session_store_sqlite_claimturn_race_test.go +++ b/internal/gateway/session_store_sqlite_claimturn_race_test.go @@ -61,6 +61,7 @@ func TestClaimTurnConcurrentInsertRaceNeverReturnsAnError(t *testing.T) { const stores = 2 const trials = 100 const maxRetriesPerAttempt = 20 + const busyRetryDelay = time.Millisecond openers := make([]TurnLedger, stores) for i := range openers { @@ -90,6 +91,7 @@ func TestClaimTurnConcurrentInsertRaceNeverReturnsAnError(t *testing.T) { if err == nil || !strings.Contains(err.Error(), "database is locked") { return err } + time.Sleep(busyRetryDelay) } return err }