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.
This commit is contained in:
sam committed 2026-08-23 04:08:49 +10:00
1 parent c0600f55c6
commit d30e5608ef
1 file changed
+2
@@ -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
}