Using moveToWait
This can be handled using themoveToWait method. However, it is important to note that when a job is being processed by a worker, the worker keeps a lock on this job with a certain token value. For the moveToWait method to work, we need to pass said token so that it can unlock without error.
Finally, we need to exit from the processor by throwing a special error (WaitingError) that will signal to the worker that the job has been retried so that it does not try to complete (or fail the job) instead.
When to Use Manual Retrying
Temporary Failures
Retry immediately for transient errors like network blips
Rate Limiting
Move job back to wait when hitting rate limits
Resource Contention
Retry when a required resource is temporarily unavailable
Quick Recovery
Retry without waiting for backoff delay
Comparison with Standard Retries
| Feature | Manual Retry | Standard Retry |
|---|---|---|
| Timing | Immediate | Uses backoff delay |
| Attempts counter | Not incremented | Incremented |
| Control | Full control in processor | Configured via options |
| Use case | Transient errors | Persistent errors |
Example: Retry on Rate Limit
Related Resources
Retrying Failed Jobs
Learn about standard retry strategies
Rate Limiting
Implement rate limiting for your queues
Move To Wait API
API reference for moveToWait method
