Skip to content

Commit

Permalink
Merge pull request #56 from makasim/pgdriver-break-tx-on-error
Browse files Browse the repository at this point in the history
pgdriver: break commiter tx on conflict error
  • Loading branch information
makasim authored Nov 10, 2024
2 parents c26250a + 741a4ae commit 2abddbf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pgdriver/commiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ func (cmtr *Commiter) Do(cmd0 flowstate.Command) error {
if committableStateCtx.Committed.Rev > 0 {
if err := cmtr.q.UpdateState(context.Background(), tx, &nextState); isConflict(err) {
conflictErr.Add(fmt.Sprintf("%T", cmd), committableStateCtx.Current.ID, err)
continue
return conflictErr
} else if err != nil {
return fmt.Errorf("update state: %w", err)
}
} else {
if err := cmtr.q.InsertState(context.Background(), tx, &nextState); isConflict(err) {
conflictErr.Add(fmt.Sprintf("%T", cmd), committableStateCtx.Current.ID, err)
continue
return conflictErr
} else if err != nil {
return fmt.Errorf("insert state: %w", err)
}
Expand Down

0 comments on commit 2abddbf

Please sign in to comment.