@cdklabs/cdk-ecs-codedeploy 0.0.168 → 0.0.169
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +3 -3
- package/lib/api-canary/index.js +1 -1
- package/lib/ecs-appspec/index.js +1 -1
- package/lib/ecs-deployment/index.js +1 -1
- package/lib/ecs-patterns/application-load-balanced-codedeployed-fargate-service.js +1 -1
- package/node_modules/@aws-sdk/abort-controller/dist-types/AbortController.d.ts +4 -1
- package/node_modules/@aws-sdk/abort-controller/dist-types/AbortSignal.d.ts +4 -0
- package/node_modules/@aws-sdk/abort-controller/dist-types/index.d.ts +7 -0
- package/node_modules/@aws-sdk/abort-controller/dist-types/ts3.4/AbortController.d.ts +1 -0
- package/node_modules/@aws-sdk/abort-controller/dist-types/ts3.4/AbortSignal.d.ts +1 -0
- package/node_modules/@aws-sdk/abort-controller/package.json +2 -2
- package/node_modules/@aws-sdk/client-codedeploy/package.json +29 -29
- package/node_modules/@aws-sdk/client-sso/package.json +25 -25
- package/node_modules/@aws-sdk/client-sso-oidc/package.json +25 -25
- package/node_modules/@aws-sdk/client-sts/package.json +28 -28
- package/node_modules/@aws-sdk/config-resolver/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-imds/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-node/package.json +10 -10
- package/node_modules/@aws-sdk/credential-provider-process/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/fetch-http-handler/package.json +5 -5
- package/node_modules/@aws-sdk/hash-node/package.json +2 -2
- package/node_modules/@aws-sdk/invalid-dependency/package.json +2 -2
- package/node_modules/@aws-sdk/middleware-content-length/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-endpoint/package.json +5 -5
- package/node_modules/@aws-sdk/middleware-host-header/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-logger/package.json +2 -2
- package/node_modules/@aws-sdk/middleware-recursion-detection/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-retry/dist-types/types.d.ts +3 -3
- package/node_modules/@aws-sdk/middleware-retry/package.json +7 -7
- package/node_modules/@aws-sdk/middleware-sdk-sts/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-serde/package.json +2 -2
- package/node_modules/@aws-sdk/middleware-signing/package.json +6 -6
- package/node_modules/@aws-sdk/middleware-stack/package.json +2 -2
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +4 -4
- package/node_modules/@aws-sdk/node-config-provider/package.json +4 -4
- package/node_modules/@aws-sdk/node-http-handler/package.json +5 -5
- package/node_modules/@aws-sdk/property-provider/package.json +2 -2
- package/node_modules/@aws-sdk/protocol-http/package.json +2 -2
- package/node_modules/@aws-sdk/querystring-builder/package.json +2 -2
- package/node_modules/@aws-sdk/querystring-parser/package.json +2 -2
- package/node_modules/@aws-sdk/service-error-classification/package.json +2 -2
- package/node_modules/@aws-sdk/shared-ini-file-loader/package.json +2 -2
- package/node_modules/@aws-sdk/signature-v4/package.json +4 -4
- package/node_modules/@aws-sdk/smithy-client/package.json +3 -3
- package/node_modules/@aws-sdk/token-providers/package.json +5 -5
- package/node_modules/@aws-sdk/types/dist-types/retry.d.ts +2 -16
- package/node_modules/@aws-sdk/types/dist-types/ts3.4/retry.d.ts +1 -4
- package/node_modules/@aws-sdk/types/package.json +1 -1
- package/node_modules/@aws-sdk/url-parser/package.json +3 -3
- package/node_modules/@aws-sdk/util-defaults-mode-browser/package.json +4 -4
- package/node_modules/@aws-sdk/util-defaults-mode-node/package.json +7 -7
- package/node_modules/@aws-sdk/util-endpoints/package.json +2 -2
- package/node_modules/@aws-sdk/util-middleware/package.json +2 -2
- package/node_modules/@aws-sdk/util-retry/dist-cjs/StandardRetryStrategy.js +31 -9
- package/node_modules/@aws-sdk/util-retry/dist-cjs/defaultRetryToken.js +6 -46
- package/node_modules/@aws-sdk/util-retry/dist-es/StandardRetryStrategy.js +32 -11
- package/node_modules/@aws-sdk/util-retry/dist-es/defaultRetryToken.js +5 -44
- package/node_modules/@aws-sdk/util-retry/dist-types/StandardRetryStrategy.d.ts +10 -2
- package/node_modules/@aws-sdk/util-retry/dist-types/defaultRetryToken.d.ts +6 -20
- package/node_modules/@aws-sdk/util-retry/dist-types/ts3.4/StandardRetryStrategy.d.ts +5 -2
- package/node_modules/@aws-sdk/util-retry/dist-types/ts3.4/defaultRetryToken.d.ts +10 -15
- package/node_modules/@aws-sdk/util-retry/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-browser/package.json +2 -2
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +3 -3
- package/node_modules/@aws-sdk/util-waiter/package.json +3 -3
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/smithy-client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.341.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aws-sdk/middleware-stack": "3.
|
|
25
|
-
"@aws-sdk/types": "3.
|
|
24
|
+
"@aws-sdk/middleware-stack": "3.341.0",
|
|
25
|
+
"@aws-sdk/types": "3.341.0",
|
|
26
26
|
"tslib": "^2.5.0"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/token-providers",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.341.0",
|
|
4
4
|
"description": "A collection of token providers",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
},
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aws-sdk/client-sso-oidc": "3.
|
|
30
|
-
"@aws-sdk/property-provider": "3.
|
|
31
|
-
"@aws-sdk/shared-ini-file-loader": "3.
|
|
32
|
-
"@aws-sdk/types": "3.
|
|
29
|
+
"@aws-sdk/client-sso-oidc": "3.341.0",
|
|
30
|
+
"@aws-sdk/property-provider": "3.341.0",
|
|
31
|
+
"@aws-sdk/shared-ini-file-loader": "3.341.0",
|
|
32
|
+
"@aws-sdk/types": "3.341.0",
|
|
33
33
|
"tslib": "^2.5.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -83,23 +83,9 @@ export interface RetryToken {
|
|
|
83
83
|
*/
|
|
84
84
|
export interface StandardRetryToken extends RetryToken {
|
|
85
85
|
/**
|
|
86
|
-
* @returns
|
|
86
|
+
* @returns the cost of the last retry attempt.
|
|
87
87
|
*/
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @returns the number of available tokens.
|
|
91
|
-
*/
|
|
92
|
-
getRetryTokenCount(errorInfo: RetryErrorInfo): number;
|
|
93
|
-
/**
|
|
94
|
-
* @returns the cost of the last retry attemp.
|
|
95
|
-
*/
|
|
96
|
-
getLastRetryCost(): number | undefined;
|
|
97
|
-
/**
|
|
98
|
-
* Releases a number of tokens.
|
|
99
|
-
*
|
|
100
|
-
* @param amount - of tokens to release.
|
|
101
|
-
*/
|
|
102
|
-
releaseRetryTokens(amount?: number): void;
|
|
88
|
+
getRetryCost(): number | undefined;
|
|
103
89
|
}
|
|
104
90
|
/**
|
|
105
91
|
* @public
|
|
@@ -22,10 +22,7 @@ export interface RetryToken {
|
|
|
22
22
|
getRetryDelay(): number;
|
|
23
23
|
}
|
|
24
24
|
export interface StandardRetryToken extends RetryToken {
|
|
25
|
-
|
|
26
|
-
getRetryTokenCount(errorInfo: RetryErrorInfo): number;
|
|
27
|
-
getLastRetryCost(): number | undefined;
|
|
28
|
-
releaseRetryTokens(amount?: number): void;
|
|
25
|
+
getRetryCost(): number | undefined;
|
|
29
26
|
}
|
|
30
27
|
export interface RetryStrategyV2 {
|
|
31
28
|
acquireInitialRetryToken(retryTokenScope: string): Promise<RetryToken>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/url-parser",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.341.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aws-sdk/querystring-parser": "3.
|
|
24
|
-
"@aws-sdk/types": "3.
|
|
23
|
+
"@aws-sdk/querystring-parser": "3.341.0",
|
|
24
|
+
"@aws-sdk/types": "3.341.0",
|
|
25
25
|
"tslib": "^2.5.0"
|
|
26
26
|
},
|
|
27
27
|
"typesVersions": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-defaults-mode-browser",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.341.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
},
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@aws-sdk/property-provider": "3.
|
|
23
|
-
"@aws-sdk/types": "3.
|
|
22
|
+
"@aws-sdk/property-provider": "3.341.0",
|
|
23
|
+
"@aws-sdk/types": "3.341.0",
|
|
24
24
|
"bowser": "^2.11.0",
|
|
25
25
|
"tslib": "^2.5.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@aws-sdk/smithy-client": "3.
|
|
28
|
+
"@aws-sdk/smithy-client": "3.341.0",
|
|
29
29
|
"@tsconfig/recommended": "1.0.1",
|
|
30
30
|
"@types/node": "^14.14.31",
|
|
31
31
|
"concurrently": "7.0.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-defaults-mode-node",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.341.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
},
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@aws-sdk/config-resolver": "3.
|
|
23
|
-
"@aws-sdk/credential-provider-imds": "3.
|
|
24
|
-
"@aws-sdk/node-config-provider": "3.
|
|
25
|
-
"@aws-sdk/property-provider": "3.
|
|
26
|
-
"@aws-sdk/types": "3.
|
|
22
|
+
"@aws-sdk/config-resolver": "3.341.0",
|
|
23
|
+
"@aws-sdk/credential-provider-imds": "3.341.0",
|
|
24
|
+
"@aws-sdk/node-config-provider": "3.341.0",
|
|
25
|
+
"@aws-sdk/property-provider": "3.341.0",
|
|
26
|
+
"@aws-sdk/types": "3.341.0",
|
|
27
27
|
"tslib": "^2.5.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@aws-sdk/smithy-client": "3.
|
|
30
|
+
"@aws-sdk/smithy-client": "3.341.0",
|
|
31
31
|
"@tsconfig/recommended": "1.0.1",
|
|
32
32
|
"@types/node": "^14.14.31",
|
|
33
33
|
"concurrently": "7.0.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-endpoints",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.341.0",
|
|
4
4
|
"description": "Utilities to help with endpoint resolution",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@aws-sdk/types": "3.
|
|
25
|
+
"@aws-sdk/types": "3.341.0",
|
|
26
26
|
"tslib": "^2.5.0"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-middleware",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.341.0",
|
|
4
4
|
"description": "Shared utilities for to be used in middleware packages.",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"tslib": "^2.5.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@aws-sdk/types": "3.
|
|
30
|
+
"@aws-sdk/types": "3.341.0",
|
|
31
31
|
"@tsconfig/recommended": "1.0.1",
|
|
32
32
|
"@types/node": "^14.14.31",
|
|
33
33
|
"concurrently": "7.0.0",
|
|
@@ -3,30 +3,49 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StandardRetryStrategy = void 0;
|
|
4
4
|
const config_1 = require("./config");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
|
+
const defaultRetryBackoffStrategy_1 = require("./defaultRetryBackoffStrategy");
|
|
6
7
|
const defaultRetryToken_1 = require("./defaultRetryToken");
|
|
7
8
|
class StandardRetryStrategy {
|
|
8
9
|
constructor(maxAttempts) {
|
|
9
10
|
this.maxAttempts = maxAttempts;
|
|
10
11
|
this.mode = config_1.RETRY_MODES.STANDARD;
|
|
11
|
-
this.
|
|
12
|
+
this.capacity = constants_1.INITIAL_RETRY_TOKENS;
|
|
13
|
+
this.retryBackoffStrategy = (0, defaultRetryBackoffStrategy_1.getDefaultRetryBackoffStrategy)();
|
|
12
14
|
this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts;
|
|
13
15
|
}
|
|
14
16
|
async acquireInitialRetryToken(retryTokenScope) {
|
|
15
|
-
return
|
|
17
|
+
return (0, defaultRetryToken_1.createDefaultRetryToken)({
|
|
18
|
+
retryDelay: constants_1.DEFAULT_RETRY_DELAY_BASE,
|
|
19
|
+
retryCount: 0,
|
|
20
|
+
});
|
|
16
21
|
}
|
|
17
|
-
async refreshRetryTokenForRetry(
|
|
22
|
+
async refreshRetryTokenForRetry(token, errorInfo) {
|
|
18
23
|
const maxAttempts = await this.getMaxAttempts();
|
|
19
|
-
if (this.shouldRetry(
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
if (this.shouldRetry(token, errorInfo, maxAttempts)) {
|
|
25
|
+
const errorType = errorInfo.errorType;
|
|
26
|
+
this.retryBackoffStrategy.setDelayBase(errorType === "THROTTLING" ? constants_1.THROTTLING_RETRY_DELAY_BASE : constants_1.DEFAULT_RETRY_DELAY_BASE);
|
|
27
|
+
const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount());
|
|
28
|
+
const retryDelay = errorInfo.retryAfterHint
|
|
29
|
+
? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType)
|
|
30
|
+
: delayFromErrorType;
|
|
31
|
+
const capacityCost = this.getCapacityCost(errorType);
|
|
32
|
+
this.capacity -= capacityCost;
|
|
33
|
+
return (0, defaultRetryToken_1.createDefaultRetryToken)({
|
|
34
|
+
retryDelay,
|
|
35
|
+
retryCount: token.getRetryCount() + 1,
|
|
36
|
+
retryCost: capacityCost,
|
|
37
|
+
});
|
|
22
38
|
}
|
|
23
39
|
throw new Error("No retry token available");
|
|
24
40
|
}
|
|
25
41
|
recordSuccess(token) {
|
|
26
|
-
|
|
42
|
+
var _a;
|
|
43
|
+
this.capacity = Math.max(constants_1.INITIAL_RETRY_TOKENS, this.capacity + ((_a = token.getRetryCost()) !== null && _a !== void 0 ? _a : constants_1.NO_RETRY_INCREMENT));
|
|
44
|
+
}
|
|
45
|
+
getCapacity() {
|
|
46
|
+
return this.capacity;
|
|
27
47
|
}
|
|
28
48
|
async getMaxAttempts() {
|
|
29
|
-
let maxAttempts;
|
|
30
49
|
try {
|
|
31
50
|
return await this.maxAttemptsProvider();
|
|
32
51
|
}
|
|
@@ -38,9 +57,12 @@ class StandardRetryStrategy {
|
|
|
38
57
|
shouldRetry(tokenToRenew, errorInfo, maxAttempts) {
|
|
39
58
|
const attempts = tokenToRenew.getRetryCount();
|
|
40
59
|
return (attempts < maxAttempts &&
|
|
41
|
-
|
|
60
|
+
this.capacity >= this.getCapacityCost(errorInfo.errorType) &&
|
|
42
61
|
this.isRetryableError(errorInfo.errorType));
|
|
43
62
|
}
|
|
63
|
+
getCapacityCost(errorType) {
|
|
64
|
+
return errorType === "TRANSIENT" ? constants_1.TIMEOUT_RETRY_COST : constants_1.RETRY_COST;
|
|
65
|
+
}
|
|
44
66
|
isRetryableError(errorType) {
|
|
45
67
|
return errorType === "THROTTLING" || errorType === "TRANSIENT";
|
|
46
68
|
}
|
|
@@ -1,55 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createDefaultRetryToken = void 0;
|
|
4
4
|
const constants_1 = require("./constants");
|
|
5
|
-
const
|
|
6
|
-
const getDefaultRetryToken = (initialRetryTokens, initialRetryDelay, initialRetryCount, options) => {
|
|
7
|
-
var _a, _b, _c;
|
|
8
|
-
const MAX_CAPACITY = initialRetryTokens;
|
|
9
|
-
const retryCost = (_a = options === null || options === void 0 ? void 0 : options.retryCost) !== null && _a !== void 0 ? _a : constants_1.RETRY_COST;
|
|
10
|
-
const timeoutRetryCost = (_b = options === null || options === void 0 ? void 0 : options.timeoutRetryCost) !== null && _b !== void 0 ? _b : constants_1.TIMEOUT_RETRY_COST;
|
|
11
|
-
const retryBackoffStrategy = (_c = options === null || options === void 0 ? void 0 : options.retryBackoffStrategy) !== null && _c !== void 0 ? _c : (0, defaultRetryBackoffStrategy_1.getDefaultRetryBackoffStrategy)();
|
|
12
|
-
let availableCapacity = initialRetryTokens;
|
|
13
|
-
let retryDelay = Math.min(constants_1.MAXIMUM_RETRY_DELAY, initialRetryDelay);
|
|
14
|
-
let lastRetryCost = undefined;
|
|
15
|
-
let retryCount = initialRetryCount !== null && initialRetryCount !== void 0 ? initialRetryCount : 0;
|
|
16
|
-
const getCapacityAmount = (errorType) => (errorType === "TRANSIENT" ? timeoutRetryCost : retryCost);
|
|
5
|
+
const createDefaultRetryToken = ({ retryDelay, retryCount, retryCost, }) => {
|
|
17
6
|
const getRetryCount = () => retryCount;
|
|
18
|
-
const getRetryDelay = () => retryDelay;
|
|
19
|
-
const
|
|
20
|
-
const hasRetryTokens = (errorType) => getCapacityAmount(errorType) <= availableCapacity;
|
|
21
|
-
const getRetryTokenCount = (errorInfo) => {
|
|
22
|
-
const errorType = errorInfo.errorType;
|
|
23
|
-
if (!hasRetryTokens(errorType)) {
|
|
24
|
-
throw new Error("No retry token available");
|
|
25
|
-
}
|
|
26
|
-
const capacityAmount = getCapacityAmount(errorType);
|
|
27
|
-
const delayBase = errorType === "THROTTLING" ? constants_1.THROTTLING_RETRY_DELAY_BASE : constants_1.DEFAULT_RETRY_DELAY_BASE;
|
|
28
|
-
retryBackoffStrategy.setDelayBase(delayBase);
|
|
29
|
-
const delayFromErrorType = retryBackoffStrategy.computeNextBackoffDelay(retryCount);
|
|
30
|
-
if (errorInfo.retryAfterHint) {
|
|
31
|
-
const delayFromRetryAfterHint = errorInfo.retryAfterHint.getTime() - Date.now();
|
|
32
|
-
retryDelay = Math.max(delayFromRetryAfterHint || 0, delayFromErrorType);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
retryDelay = delayFromErrorType;
|
|
36
|
-
}
|
|
37
|
-
retryCount++;
|
|
38
|
-
lastRetryCost = capacityAmount;
|
|
39
|
-
availableCapacity -= capacityAmount;
|
|
40
|
-
return capacityAmount;
|
|
41
|
-
};
|
|
42
|
-
const releaseRetryTokens = (releaseAmount) => {
|
|
43
|
-
availableCapacity += releaseAmount !== null && releaseAmount !== void 0 ? releaseAmount : constants_1.NO_RETRY_INCREMENT;
|
|
44
|
-
availableCapacity = Math.min(availableCapacity, MAX_CAPACITY);
|
|
45
|
-
};
|
|
7
|
+
const getRetryDelay = () => Math.min(constants_1.MAXIMUM_RETRY_DELAY, retryDelay);
|
|
8
|
+
const getRetryCost = () => retryCost;
|
|
46
9
|
return {
|
|
47
10
|
getRetryCount,
|
|
48
11
|
getRetryDelay,
|
|
49
|
-
|
|
50
|
-
hasRetryTokens,
|
|
51
|
-
getRetryTokenCount,
|
|
52
|
-
releaseRetryTokens,
|
|
12
|
+
getRetryCost,
|
|
53
13
|
};
|
|
54
14
|
};
|
|
55
|
-
exports.
|
|
15
|
+
exports.createDefaultRetryToken = createDefaultRetryToken;
|
|
@@ -1,29 +1,47 @@
|
|
|
1
1
|
import { DEFAULT_MAX_ATTEMPTS, RETRY_MODES } from "./config";
|
|
2
|
-
import { DEFAULT_RETRY_DELAY_BASE, INITIAL_RETRY_TOKENS } from "./constants";
|
|
3
|
-
import {
|
|
2
|
+
import { DEFAULT_RETRY_DELAY_BASE, INITIAL_RETRY_TOKENS, NO_RETRY_INCREMENT, RETRY_COST, THROTTLING_RETRY_DELAY_BASE, TIMEOUT_RETRY_COST, } from "./constants";
|
|
3
|
+
import { getDefaultRetryBackoffStrategy } from "./defaultRetryBackoffStrategy";
|
|
4
|
+
import { createDefaultRetryToken } from "./defaultRetryToken";
|
|
4
5
|
export class StandardRetryStrategy {
|
|
5
6
|
constructor(maxAttempts) {
|
|
6
7
|
this.maxAttempts = maxAttempts;
|
|
7
8
|
this.mode = RETRY_MODES.STANDARD;
|
|
8
|
-
this.
|
|
9
|
+
this.capacity = INITIAL_RETRY_TOKENS;
|
|
10
|
+
this.retryBackoffStrategy = getDefaultRetryBackoffStrategy();
|
|
9
11
|
this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts;
|
|
10
12
|
}
|
|
11
13
|
async acquireInitialRetryToken(retryTokenScope) {
|
|
12
|
-
return
|
|
14
|
+
return createDefaultRetryToken({
|
|
15
|
+
retryDelay: DEFAULT_RETRY_DELAY_BASE,
|
|
16
|
+
retryCount: 0,
|
|
17
|
+
});
|
|
13
18
|
}
|
|
14
|
-
async refreshRetryTokenForRetry(
|
|
19
|
+
async refreshRetryTokenForRetry(token, errorInfo) {
|
|
15
20
|
const maxAttempts = await this.getMaxAttempts();
|
|
16
|
-
if (this.shouldRetry(
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
if (this.shouldRetry(token, errorInfo, maxAttempts)) {
|
|
22
|
+
const errorType = errorInfo.errorType;
|
|
23
|
+
this.retryBackoffStrategy.setDelayBase(errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE);
|
|
24
|
+
const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount());
|
|
25
|
+
const retryDelay = errorInfo.retryAfterHint
|
|
26
|
+
? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType)
|
|
27
|
+
: delayFromErrorType;
|
|
28
|
+
const capacityCost = this.getCapacityCost(errorType);
|
|
29
|
+
this.capacity -= capacityCost;
|
|
30
|
+
return createDefaultRetryToken({
|
|
31
|
+
retryDelay,
|
|
32
|
+
retryCount: token.getRetryCount() + 1,
|
|
33
|
+
retryCost: capacityCost,
|
|
34
|
+
});
|
|
19
35
|
}
|
|
20
36
|
throw new Error("No retry token available");
|
|
21
37
|
}
|
|
22
38
|
recordSuccess(token) {
|
|
23
|
-
this.
|
|
39
|
+
this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT));
|
|
40
|
+
}
|
|
41
|
+
getCapacity() {
|
|
42
|
+
return this.capacity;
|
|
24
43
|
}
|
|
25
44
|
async getMaxAttempts() {
|
|
26
|
-
let maxAttempts;
|
|
27
45
|
try {
|
|
28
46
|
return await this.maxAttemptsProvider();
|
|
29
47
|
}
|
|
@@ -35,9 +53,12 @@ export class StandardRetryStrategy {
|
|
|
35
53
|
shouldRetry(tokenToRenew, errorInfo, maxAttempts) {
|
|
36
54
|
const attempts = tokenToRenew.getRetryCount();
|
|
37
55
|
return (attempts < maxAttempts &&
|
|
38
|
-
|
|
56
|
+
this.capacity >= this.getCapacityCost(errorInfo.errorType) &&
|
|
39
57
|
this.isRetryableError(errorInfo.errorType));
|
|
40
58
|
}
|
|
59
|
+
getCapacityCost(errorType) {
|
|
60
|
+
return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST;
|
|
61
|
+
}
|
|
41
62
|
isRetryableError(errorType) {
|
|
42
63
|
return errorType === "THROTTLING" || errorType === "TRANSIENT";
|
|
43
64
|
}
|
|
@@ -1,50 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export const getDefaultRetryToken = (initialRetryTokens, initialRetryDelay, initialRetryCount, options) => {
|
|
4
|
-
const MAX_CAPACITY = initialRetryTokens;
|
|
5
|
-
const retryCost = options?.retryCost ?? RETRY_COST;
|
|
6
|
-
const timeoutRetryCost = options?.timeoutRetryCost ?? TIMEOUT_RETRY_COST;
|
|
7
|
-
const retryBackoffStrategy = options?.retryBackoffStrategy ?? getDefaultRetryBackoffStrategy();
|
|
8
|
-
let availableCapacity = initialRetryTokens;
|
|
9
|
-
let retryDelay = Math.min(MAXIMUM_RETRY_DELAY, initialRetryDelay);
|
|
10
|
-
let lastRetryCost = undefined;
|
|
11
|
-
let retryCount = initialRetryCount ?? 0;
|
|
12
|
-
const getCapacityAmount = (errorType) => (errorType === "TRANSIENT" ? timeoutRetryCost : retryCost);
|
|
1
|
+
import { MAXIMUM_RETRY_DELAY } from "./constants";
|
|
2
|
+
export const createDefaultRetryToken = ({ retryDelay, retryCount, retryCost, }) => {
|
|
13
3
|
const getRetryCount = () => retryCount;
|
|
14
|
-
const getRetryDelay = () => retryDelay;
|
|
15
|
-
const
|
|
16
|
-
const hasRetryTokens = (errorType) => getCapacityAmount(errorType) <= availableCapacity;
|
|
17
|
-
const getRetryTokenCount = (errorInfo) => {
|
|
18
|
-
const errorType = errorInfo.errorType;
|
|
19
|
-
if (!hasRetryTokens(errorType)) {
|
|
20
|
-
throw new Error("No retry token available");
|
|
21
|
-
}
|
|
22
|
-
const capacityAmount = getCapacityAmount(errorType);
|
|
23
|
-
const delayBase = errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE;
|
|
24
|
-
retryBackoffStrategy.setDelayBase(delayBase);
|
|
25
|
-
const delayFromErrorType = retryBackoffStrategy.computeNextBackoffDelay(retryCount);
|
|
26
|
-
if (errorInfo.retryAfterHint) {
|
|
27
|
-
const delayFromRetryAfterHint = errorInfo.retryAfterHint.getTime() - Date.now();
|
|
28
|
-
retryDelay = Math.max(delayFromRetryAfterHint || 0, delayFromErrorType);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
retryDelay = delayFromErrorType;
|
|
32
|
-
}
|
|
33
|
-
retryCount++;
|
|
34
|
-
lastRetryCost = capacityAmount;
|
|
35
|
-
availableCapacity -= capacityAmount;
|
|
36
|
-
return capacityAmount;
|
|
37
|
-
};
|
|
38
|
-
const releaseRetryTokens = (releaseAmount) => {
|
|
39
|
-
availableCapacity += releaseAmount ?? NO_RETRY_INCREMENT;
|
|
40
|
-
availableCapacity = Math.min(availableCapacity, MAX_CAPACITY);
|
|
41
|
-
};
|
|
4
|
+
const getRetryDelay = () => Math.min(MAXIMUM_RETRY_DELAY, retryDelay);
|
|
5
|
+
const getRetryCost = () => retryCost;
|
|
42
6
|
return {
|
|
43
7
|
getRetryCount,
|
|
44
8
|
getRetryDelay,
|
|
45
|
-
|
|
46
|
-
hasRetryTokens,
|
|
47
|
-
getRetryTokenCount,
|
|
48
|
-
releaseRetryTokens,
|
|
9
|
+
getRetryCost,
|
|
49
10
|
};
|
|
50
11
|
};
|
|
@@ -5,14 +5,22 @@ import { Provider, RetryErrorInfo, RetryStrategyV2, StandardRetryToken } from "@
|
|
|
5
5
|
export declare class StandardRetryStrategy implements RetryStrategyV2 {
|
|
6
6
|
private readonly maxAttempts;
|
|
7
7
|
readonly mode: string;
|
|
8
|
-
private
|
|
8
|
+
private capacity;
|
|
9
|
+
private readonly retryBackoffStrategy;
|
|
9
10
|
private readonly maxAttemptsProvider;
|
|
10
11
|
constructor(maxAttempts: number);
|
|
11
12
|
constructor(maxAttemptsProvider: Provider<number>);
|
|
12
13
|
acquireInitialRetryToken(retryTokenScope: string): Promise<StandardRetryToken>;
|
|
13
|
-
refreshRetryTokenForRetry(
|
|
14
|
+
refreshRetryTokenForRetry(token: StandardRetryToken, errorInfo: RetryErrorInfo): Promise<StandardRetryToken>;
|
|
14
15
|
recordSuccess(token: StandardRetryToken): void;
|
|
16
|
+
/**
|
|
17
|
+
* @returns the current available retry capacity.
|
|
18
|
+
*
|
|
19
|
+
* This number decreases when retries are executed and refills when requests or retries succeed.
|
|
20
|
+
*/
|
|
21
|
+
getCapacity(): number;
|
|
15
22
|
private getMaxAttempts;
|
|
16
23
|
private shouldRetry;
|
|
24
|
+
private getCapacityCost;
|
|
17
25
|
private isRetryableError;
|
|
18
26
|
}
|
|
@@ -1,23 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
|
-
export interface DefaultRetryTokenOptions {
|
|
6
|
-
/**
|
|
7
|
-
* The total amount of retry tokens to be decremented from retry token balance.
|
|
8
|
-
*/
|
|
9
|
-
retryCost?: number;
|
|
10
|
-
/**
|
|
11
|
-
* The total amount of retry tokens to be decremented from retry token balance
|
|
12
|
-
* when a throttling error is encountered.
|
|
13
|
-
*/
|
|
14
|
-
timeoutRetryCost?: number;
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
retryBackoffStrategy?: StandardRetryBackoffStrategy;
|
|
19
|
-
}
|
|
1
|
+
import { StandardRetryToken } from "@aws-sdk/types";
|
|
20
2
|
/**
|
|
21
3
|
* @internal
|
|
22
4
|
*/
|
|
23
|
-
export declare const
|
|
5
|
+
export declare const createDefaultRetryToken: ({ retryDelay, retryCount, retryCost, }: {
|
|
6
|
+
retryDelay: number;
|
|
7
|
+
retryCount: number;
|
|
8
|
+
retryCost?: number | undefined;
|
|
9
|
+
}) => StandardRetryToken;
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
export declare class StandardRetryStrategy implements RetryStrategyV2 {
|
|
8
8
|
private readonly maxAttempts;
|
|
9
9
|
readonly mode: string;
|
|
10
|
-
private
|
|
10
|
+
private capacity;
|
|
11
|
+
private readonly retryBackoffStrategy;
|
|
11
12
|
private readonly maxAttemptsProvider;
|
|
12
13
|
constructor(maxAttempts: number);
|
|
13
14
|
constructor(maxAttemptsProvider: Provider<number>);
|
|
@@ -15,11 +16,13 @@ export declare class StandardRetryStrategy implements RetryStrategyV2 {
|
|
|
15
16
|
retryTokenScope: string
|
|
16
17
|
): Promise<StandardRetryToken>;
|
|
17
18
|
refreshRetryTokenForRetry(
|
|
18
|
-
|
|
19
|
+
token: StandardRetryToken,
|
|
19
20
|
errorInfo: RetryErrorInfo
|
|
20
21
|
): Promise<StandardRetryToken>;
|
|
21
22
|
recordSuccess(token: StandardRetryToken): void;
|
|
23
|
+
getCapacity(): number;
|
|
22
24
|
private getMaxAttempts;
|
|
23
25
|
private shouldRetry;
|
|
26
|
+
private getCapacityCost;
|
|
24
27
|
private isRetryableError;
|
|
25
28
|
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
initialRetryTokens: number,
|
|
12
|
-
initialRetryDelay: number,
|
|
13
|
-
initialRetryCount?: number,
|
|
14
|
-
options?: DefaultRetryTokenOptions
|
|
15
|
-
) => StandardRetryToken;
|
|
1
|
+
import { StandardRetryToken } from "@aws-sdk/types";
|
|
2
|
+
export declare const createDefaultRetryToken: ({
|
|
3
|
+
retryDelay,
|
|
4
|
+
retryCount,
|
|
5
|
+
retryCost,
|
|
6
|
+
}: {
|
|
7
|
+
retryDelay: number;
|
|
8
|
+
retryCount: number;
|
|
9
|
+
retryCost?: number | undefined;
|
|
10
|
+
}) => StandardRetryToken;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-retry",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.341.0",
|
|
4
4
|
"description": "Shared retry utilities to be used in middleware packages.",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aws-sdk/service-error-classification": "3.
|
|
28
|
+
"@aws-sdk/service-error-classification": "3.341.0",
|
|
29
29
|
"tslib": "^2.5.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@aws-sdk/types": "3.
|
|
32
|
+
"@aws-sdk/types": "3.341.0",
|
|
33
33
|
"@tsconfig/recommended": "1.0.1",
|
|
34
34
|
"@types/node": "^14.14.31",
|
|
35
35
|
"concurrently": "7.0.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-user-agent-browser",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.341.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"react-native": "dist-es/index.native.js",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aws-sdk/types": "3.
|
|
24
|
+
"@aws-sdk/types": "3.341.0",
|
|
25
25
|
"bowser": "^2.11.0",
|
|
26
26
|
"tslib": "^2.5.0"
|
|
27
27
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-user-agent-node",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.341.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aws-sdk/node-config-provider": "3.
|
|
24
|
-
"@aws-sdk/types": "3.
|
|
23
|
+
"@aws-sdk/node-config-provider": "3.341.0",
|
|
24
|
+
"@aws-sdk/types": "3.341.0",
|
|
25
25
|
"tslib": "^2.5.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-waiter",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.341.0",
|
|
4
4
|
"description": "Shared utilities for client waiters for the AWS SDK",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@aws-sdk/abort-controller": "3.
|
|
7
|
-
"@aws-sdk/types": "3.
|
|
6
|
+
"@aws-sdk/abort-controller": "3.341.0",
|
|
7
|
+
"@aws-sdk/types": "3.341.0",
|
|
8
8
|
"tslib": "^2.5.0"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|