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