SQLStore: Fix SQLite error propagation if query retries are disabled (#64904)

* SQLStore: Add test when query retrying is disabled

* Fix condition

* Add test cases for sqlite3.ErrLocked
This commit is contained in:
Sofia Papagiannaki
2023-03-17 12:57:13 +02:00
committed by GitHub
parent 595518ec12
commit 41843464d1
2 changed files with 69 additions and 13 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ func (ss *SQLStore) retryOnLocks(ctx context.Context, callback DBTransactionFunc
ctxLogger.Info("Database locked, sleeping then retrying", "error", err, "retry", retry, "code", sqlError.Code)
// retryer immediately returns the error (if there is one) without checking the response
// therefore we only have to send it if we have reached the maximum retries
if retry == ss.dbCfg.QueryRetries {
if retry >= ss.dbCfg.QueryRetries {
return retryer.FuncError, ErrMaximumRetriesReached.Errorf("retry %d: %w", retry, err)
}
return retryer.FuncFailure, nil