Skip to content

Commit

Permalink
TWEAK: use errors.Is instead of direct comparison (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorchu authored Jan 19, 2021
1 parent 5a960c5 commit 5604683
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (w *Worker) start(h handler) {
}
return nil
}()
if err != nil && err != ErrEmptyQueue && !errors.Is(err, ErrDoNotRetry) {
if err != nil && !errors.Is(err, ErrEmptyQueue) && !errors.Is(err, ErrDoNotRetry) {
errFunc(err)
}
}
Expand Down Expand Up @@ -346,7 +346,7 @@ func idleWait(d time.Duration, stop <-chan struct{}) DequeueMiddleware {
return func(opt *DequeueOptions) (*Job, error) {
job, err := f(opt)
if err != nil {
if err == ErrEmptyQueue {
if errors.Is(err, ErrEmptyQueue) {
select {
case <-time.After(d):
case <-stop:
Expand Down Expand Up @@ -375,7 +375,7 @@ func retry(queue Queue) HandleMiddleware {
return func(job *Job, opt *DequeueOptions) error {
err := f(job, opt)
if err != nil {
if err == ErrUnrecoverable {
if errors.Is(err, ErrUnrecoverable) {
return nil // ack
}
if errors.Is(err, ErrDoNotRetry) {
Expand Down

0 comments on commit 5604683

Please sign in to comment.