Skip to content

Commit c7e01f8

Browse files
committed
Update doc blocks for delay/retry functions
1 parent 8f201b5 commit c7e01f8

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

src/link/retry/delayFunction.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,40 @@ export interface DelayFunction {
88
(count: number, operation: ApolloLink.Operation, error: any): number;
99
}
1010

11+
/**
12+
* Configuration options for the standard retry delay strategy.
13+
*/
1114
export interface DelayFunctionOptions {
1215
/**
1316
* The number of milliseconds to wait before attempting the first retry.
1417
*
1518
* Delays will increase exponentially for each attempt. E.g. if this is
1619
* set to 100, subsequent retries will be delayed by 200, 400, 800, etc,
17-
* until they reach maxDelay.
20+
* until they reach the maximum delay.
1821
*
1922
* Note that if jittering is enabled, this is the _average_ delay.
2023
*
21-
* Defaults to 300.
24+
* @defaultValue 300
2225
*/
2326
initial?: number;
2427

2528
/**
2629
* The maximum number of milliseconds that the link should wait for any
2730
* retry.
2831
*
29-
* Defaults to Infinity.
32+
* @defaultValue Infinity
3033
*/
3134
max?: number;
3235

3336
/**
3437
* Whether delays between attempts should be randomized.
3538
*
36-
* This helps avoid thundering herd type situations by better distributing
37-
* load during major outages.
39+
* This helps avoid [thundering herd](https://en.wikipedia.org/wiki/Thundering_herd_problem)
40+
* type situations by better distributing load during major outages. Without
41+
* these strategies, when your server comes back up it will be hit by all
42+
* of your clients at once, possibly causing it to go down again.
3843
*
39-
* Defaults to true.
44+
* @defaultValue true
4045
*/
4146
jitter?: boolean;
4247
}

src/link/retry/retryFunction.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,20 @@ export interface RetryFunction {
1212
): boolean | Promise<boolean>;
1313
}
1414

15+
/**
16+
* Configuration options for the standard retry attempt strategy.
17+
*/
1518
export interface RetryFunctionOptions {
1619
/**
1720
* The max number of times to try a single operation before giving up.
1821
*
22+
* @remarks
1923
* Note that this INCLUDES the initial request as part of the count.
20-
* E.g. maxTries of 1 indicates no retrying should occur.
24+
* E.g. `max` of 1 indicates no retrying should occur.
25+
*
26+
* Pass `Infinity` for infinite retries.
2127
*
22-
* Defaults to 5. Pass Infinity for infinite retries.
28+
* @defaultValue 5
2329
*/
2430
max?: number;
2531

0 commit comments

Comments
 (0)