UNPKG

322 BJavaScriptView Raw
1'use strict';
2
3const strategies = new Map();
4
5strategies.set('immediate', () => 0);
6
7strategies.set('fixed', (job) => job.options.backoff.delay);
8
9strategies.set('exponential', (job) => {
10 const backoff = job.options.backoff, delay = backoff.delay;
11 backoff.delay *= 2;
12 return delay;
13});
14
15module.exports = strategies;