Skip to content

Commit

Permalink
pgqueue: remove unnecessary test for pgx.ErrNoRows
Browse files Browse the repository at this point in the history
  • Loading branch information
ucirello committed Aug 5, 2024
1 parent a5fc1ad commit 0c58aa8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (c *Client) DumpDeadLetterQueue(ctx context.Context, queue string, n int) (
)
defer rows.Close()
for rows.Next() {
if err := rows.Scan(&id, &content); err != nil && !errors.Is(err, pgx.ErrNoRows) {
if err := rows.Scan(&id, &content); err != nil {
return fmt.Errorf("cannot read dead message: %w", err)
}
ids = append(ids, id)
Expand Down Expand Up @@ -732,7 +732,7 @@ func (c *Client) PopN(ctx context.Context, queueName string, n int) ([][]byte, e
defer rows.Close()
for rows.Next() {
var content []byte
if err := rows.Scan(&content); err != nil && !errors.Is(err, pgx.ErrNoRows) {
if err := rows.Scan(&content); err != nil {
return fmt.Errorf("cannot pop message: %w", err)
}
contents = append(contents, content)
Expand Down

0 comments on commit 0c58aa8

Please sign in to comment.