MCPcopy Create free account
hub / github.com/di-sukharev/opencommit / exponentialRetryStrategy

Function exponentialRetryStrategy

out/cli.cjs:75935–75960  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

75933 };
75934 }
75935 };
75936}
75937
75938// node_modules/@azure/core-rest-pipeline/dist/esm/retryStrategies/exponentialRetryStrategy.js
75939var DEFAULT_CLIENT_RETRY_INTERVAL = 1e3;
75940var DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1e3 * 64;
75941function exponentialRetryStrategy(options = {}) {
75942 var _a5, _b2;
75943 const retryInterval = (_a5 = options.retryDelayInMs) !== null && _a5 !== void 0 ? _a5 : DEFAULT_CLIENT_RETRY_INTERVAL;
75944 const maxRetryInterval = (_b2 = options.maxRetryDelayInMs) !== null && _b2 !== void 0 ? _b2 : DEFAULT_CLIENT_MAX_RETRY_INTERVAL;
75945 let retryAfterInMs = retryInterval;
75946 return {
75947 name: "exponentialRetryStrategy",
75948 retry({ retryCount, response, responseError }) {
75949 const matchedSystemError = isSystemError(responseError);
75950 const ignoreSystemErrors = matchedSystemError && options.ignoreSystemErrors;
75951 const isExponential = isExponentialRetryResponse(response);
75952 const ignoreExponentialResponse = isExponential && options.ignoreHttpStatusCodes;
75953 const unknownResponse = response && (isThrottlingRetryResponse(response) || !isExponential);
75954 if (unknownResponse || ignoreExponentialResponse || ignoreSystemErrors) {
75955 return { skipStrategy: true };
75956 }
75957 if (responseError && !matchedSystemError && !isExponential) {
75958 return { errorToThrow: responseError };
75959 }
75960 const exponentialDelay = retryAfterInMs * Math.pow(2, retryCount);
75961 const clampedExponentialDelay = Math.min(maxRetryInterval, exponentialDelay);
75962 retryAfterInMs = clampedExponentialDelay / 2 + getRandomIntegerInclusive(0, clampedExponentialDelay / 2);
75963 return { retryAfterInMs };

Callers 1

defaultRetryPolicyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected