···151151 case StateInProgress, StateEnqueued:
152152 // keep going and buffer the op
153153 default:
154154+ if strings.HasPrefix(j.state, "failed") {
155155+ if j.retryCount >= MaxRetries {
156156+ // Process immediately since we're out of retries
157157+ return false, nil
158158+ }
159159+ // Don't buffer the op since it'll get caught in the next retry (hopefully)
160160+ return true, nil
161161+ }
154162 return false, fmt.Errorf("invalid job state: %q", j.state)
155163 }
156164