Stop retrying jobs
When a processor throws an exception that is considered unrecoverable, you should use the UnrecoverableError
class. In this case, BullMQ will just move the job to the failed set without performing any retries, overriding any attempts
settings used when adding the job to the queue.
Fail job when manual rate-limit
When a job is rate limited using RateLimitError
and tried again, the attempts
check is ignored, as rate limiting is not considered a real error. However, if you want to manually check the attempts and avoid retrying the job, you can check job.attemptsStarted
as following:
job.attemptsMade
is increased when any error different than RateLimitError
, DelayedError
or WaitingChildrenError
is thrown. While job.attemptsStarted
is increased every time that a job is moved to active.
Read more:
Last updated