mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix sqlite3 tx retry condition operator precedence (#32897)
This commit is contained in:
parent
7b7ea5a1ce
commit
e288cd0836
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user