aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/exponential-backoff/src/delay/skip-first/skip-first.delay.ts
blob: 9f2b7f5be87ee031bcd249f88b837f3d559ec3a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { Delay } from "../delay.base";

export class SkipFirstDelay extends Delay {
    public async apply() {
        return this.isFirstAttempt ? true : super.apply();
    }

    private get isFirstAttempt() {
        return this.attempt === 0;
    }

    protected get numOfDelayedAttempts() {
        return this.attempt - 1;
    }
}