-
Notifications
You must be signed in to change notification settings - Fork 672
Expand file tree
/
Copy pathwaiter.ts
More file actions
58 lines (49 loc) · 1.37 KB
/
waiter.ts
File metadata and controls
58 lines (49 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { AbortController } from "@aws-sdk/types";
export interface WaiterConfiguration<Client> {
/**
* Required service client
*/
client: Client;
/**
* The amount of time in seconds a user is willing to wait for a waiter to complete.
*/
maxWaitTime: number;
/**
* Abort controller. Used for ending the waiter early.
*/
abortController?: AbortController;
/**
* The minimum amount of time to delay between retries in seconds. This is the
* floor of the exponential backoff. This value defaults to service default
* if not specified. This value MUST be less than or equal to maxDelay and greater than 0.
*/
minDelay?: number;
/**
* The maximum amount of time to delay between retries in seconds. This is the
* ceiling of the exponential backoff. This value defaults to service default
* if not specified. If specified, this value MUST be greater than or equal to 1.
*/
maxDelay?: number;
}
/**
* @private
*/
export const waiterServiceDefaults = {
minDelay: 2,
maxDelay: 120,
};
/**
* @private
*/
export type WaiterOptions<Client> = WaiterConfiguration<Client> &
Required<Pick<WaiterConfiguration<Client>, "minDelay" | "maxDelay">>;
export enum WaiterState {
ABORTED = "ABORTED",
FAILURE = "FAILURE",
SUCCESS = "SUCCESS",
RETRY = "RETRY",
TIMEOUT = "TIMEOUT",
}
export type WaiterResult = {
state: WaiterState;
};