Add 'failed' state to dbworkers and use it in campaigns
Created by: mrnugget
This PR does a few tiny things to fix https://github.com/sourcegraph/sourcegraph/issues/15532:
- add a
failed
state todbworker
jobs, to distinguish between jobs that are errored and retryable (errored
state) and jobs that errored but won't be retried (failed
state) - it adds a
MarkFailed
method to the store - it changes the
(*workerutil.Worker).handle
method to check whether the error returned by the handler iserrcode.IsNonRetryable
and if so, it marks the job asfailed
.
The store interface is used by a lot of different implementations, which is why there is so much boilerplate here. The actual changes are maybe ~50 lines of code.
This PR does not change the behaviour of the workers to mark jobs that have exhausted their retries as failed. That could be a future improvement.