fix sqlite3 tx retry condition operator precedence (#32897) (#32952)

This commit is contained in:
Grot (@grafanabot)
2021-04-13 19:12:06 +03:00
committed by GitHub
parent ef3cf5cc94
commit 385bf145d8
+1 -1
View File
@@ -44,7 +44,7 @@ func inTransactionWithRetryCtx(ctx context.Context, engine *xorm.Engine, callbac
// special handling of database locked errors for sqlite, then we can retry 5 times
var sqlError sqlite3.Error
if errors.As(err, &sqlError) && retry < 5 && sqlError.Code == sqlite3.ErrLocked || sqlError.Code == sqlite3.ErrBusy {
if errors.As(err, &sqlError) && retry < 5 && (sqlError.Code == sqlite3.ErrLocked || sqlError.Code == sqlite3.ErrBusy) {
if rollErr := sess.Rollback(); rollErr != nil {
return errutil.Wrapf(err, "Rolling back transaction due to error failed: %s", rollErr)
}