Skip to content

Commit

Permalink
perf(db): improve error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
arsham committed Mar 23, 2022
1 parent eca2010 commit 939260d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ func (t *Transaction) PGX(ctx context.Context, transactions ...func(pgx.Tx) erro
}()
err = fn(tx)
}()

if err == nil {
continue
}
if errors.Is(err, context.Canceled) {
err = &retry.StopError{Err: err}
ctx = context.Background()
Expand Down Expand Up @@ -142,6 +146,10 @@ func (t *Transaction) DB(ctx context.Context, transactions ...func(Tx) error) er
}()
err = fn(tx)
}()

if err == nil {
continue
}
if errors.Is(err, context.Canceled) {
err = &retry.StopError{Err: err}
ctx = context.Background()
Expand Down

0 comments on commit 939260d

Please sign in to comment.