Skip to content

Commit

Permalink
fix: move retry defaults to middleware-retry (#1363)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Jul 13, 2020
1 parent 7209d1d commit cd6cba0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
1 change: 0 additions & 1 deletion packages/middleware-retry/package.json
Expand Up @@ -18,7 +18,6 @@
"license": "Apache-2.0",
"dependencies": {
"@aws-sdk/protocol-http": "1.0.0-gamma.2",
"@aws-sdk/retry-config-provider": "1.0.0-gamma.1",
"@aws-sdk/service-error-classification": "1.0.0-gamma.2",
"@aws-sdk/types": "1.0.0-gamma.2",
"react-native-get-random-values": "^1.4.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/middleware-retry/src/defaultStrategy.spec.ts
@@ -1,11 +1,10 @@
import { HttpRequest } from "@aws-sdk/protocol-http";
import { DEFAULT_MAX_ATTEMPTS } from "@aws-sdk/retry-config-provider";
import { isThrottlingError } from "@aws-sdk/service-error-classification";
import { v4 } from "uuid";

import { DEFAULT_RETRY_DELAY_BASE, INITIAL_RETRY_TOKENS, THROTTLING_RETRY_DELAY_BASE } from "./constants";
import { getDefaultRetryQuota } from "./defaultRetryQuota";
import { RetryQuota, StandardRetryStrategy } from "./defaultStrategy";
import { DEFAULT_MAX_ATTEMPTS, RetryQuota, StandardRetryStrategy } from "./defaultStrategy";
import { defaultDelayDecider } from "./delayDecider";
import { defaultRetryDecider } from "./retryDecider";

Expand Down
12 changes: 11 additions & 1 deletion packages/middleware-retry/src/defaultStrategy.ts
@@ -1,5 +1,4 @@
import { HttpRequest } from "@aws-sdk/protocol-http";
import { DEFAULT_MAX_ATTEMPTS } from "@aws-sdk/retry-config-provider";
import { isThrottlingError } from "@aws-sdk/service-error-classification";
import { SdkError } from "@aws-sdk/smithy-client";
import { FinalizeHandler, FinalizeHandlerArguments, MetadataBearer, Provider, RetryStrategy } from "@aws-sdk/types";
Expand All @@ -10,6 +9,17 @@ import { getDefaultRetryQuota } from "./defaultRetryQuota";
import { defaultDelayDecider } from "./delayDecider";
import { defaultRetryDecider } from "./retryDecider";

/**
* The default value for how many HTTP requests an SDK should make for a
* single SDK operation invocation before giving up
*/
export const DEFAULT_MAX_ATTEMPTS = "3";

/**
* The default retry algorithm to use.
*/
export const DEFAULT_RETRY_MODE = "standard";

/**
* Determines whether an error is retryable based on the number of retries
* already attempted, the HTTP status code, and the error received (if any).
Expand Down
1 change: 1 addition & 0 deletions packages/retry-config-provider/package.json
Expand Up @@ -22,6 +22,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@aws-sdk/middleware-retry": "1.0.0-gamma.2",
"@aws-sdk/property-provider": "1.0.0-gamma.2",
"@aws-sdk/shared-ini-file-loader": "1.0.0-gamma.2",
"@aws-sdk/types": "1.0.0-gamma.2",
Expand Down
3 changes: 1 addition & 2 deletions packages/retry-config-provider/src/defaultProvider.spec.ts
@@ -1,10 +1,9 @@
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry";
import { chain, fromStatic, memoize } from "@aws-sdk/property-provider";

import {
CONFIG_MAX_ATTEMPTS,
CONFIG_RETRY_MODE,
DEFAULT_MAX_ATTEMPTS,
DEFAULT_RETRY_MODE,
ENV_MAX_ATTEMPTS,
ENV_RETRY_MODE,
maxAttemptsProvider,
Expand Down
3 changes: 1 addition & 2 deletions packages/retry-config-provider/src/defaultProvider.ts
@@ -1,3 +1,4 @@
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry";
import { chain, fromStatic, memoize } from "@aws-sdk/property-provider";
import { Provider } from "@aws-sdk/types";

Expand All @@ -6,11 +7,9 @@ import { fromSharedConfigFiles, SharedConfigInit } from "./fromSharedConfigFiles

export const ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS";
export const CONFIG_MAX_ATTEMPTS = "max_attempts";
export const DEFAULT_MAX_ATTEMPTS = "3";

export const ENV_RETRY_MODE = "AWS_RETRY_MODE";
export const CONFIG_RETRY_MODE = "retry_mode";
export const DEFAULT_RETRY_MODE = "standard";

const defaultProvider = (
configuration: SharedConfigInit = {},
Expand Down

0 comments on commit cd6cba0

Please sign in to comment.