* Compute the delay for rescheduling the job after it fails. * * @return {number} The number of milliseconds into the future to schedule it. * Negative if no defined strategy or no remaining retries.
()
| 230 | * Negative if no defined strategy or no remaining retries. |
| 231 | */ |
| 232 | computeDelay() { |
| 233 | const strategyName = this.options.backoff |
| 234 | ? this.options.backoff.strategy |
| 235 | : 'immediate'; |
| 236 | const strategy = |
| 237 | this.options.retries > 0 |
| 238 | ? this.queue.backoffStrategies.get(strategyName) |
| 239 | : null; |
| 240 | return strategy ? strategy(this) : -1; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | module.exports = Job; |