Skip to content

Commit 56f6265

Browse files
update
1 parent 2c362ce commit 56f6265

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

src/AzureAppConfigurationImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { FeatureFlagTracingOptions } from "./requestTracing/FeatureFlagTracingOp
3434
import { AIConfigurationTracingOptions } from "./requestTracing/AIConfigurationTracingOptions.js";
3535
import { KeyFilter, LabelFilter, SettingSelector } from "./types.js";
3636
import { ConfigurationClientManager } from "./ConfigurationClientManager.js";
37-
import { getFixedBackoffDuration, calculateBackoffDuration } from "./failover.js";
37+
import { getFixedBackoffDuration, calculateBackoffDuration } from "./backoffDuration.js";
3838
import { InvalidOperationError, ArgumentError, isFailoverableError, isRetriableError, isArgumentError } from "./error.js";
3939

4040
const MIN_DELAY_FOR_UNHANDLED_FAILURE = 5_000; // 5 seconds

src/ConfigurationClientManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { TokenCredential } from "@azure/identity";
77
import { AzureAppConfigurationOptions } from "./AzureAppConfigurationOptions.js";
88
import { isBrowser, isWebWorker } from "./requestTracing/utils.js";
99
import * as RequestTracing from "./requestTracing/constants.js";
10-
import { instanceOfTokenCredential, shuffleList } from "./common/utils.js";
10+
import { shuffleList, instanceOfTokenCredential } from "./common/utils.js";
1111
import { ArgumentError } from "./error.js";
1212

1313
// Configuration client retry options

src/ConfigurationClientWrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT license.
33

44
import { AppConfigurationClient } from "@azure/app-configuration";
5-
import { calculateBackoffDuration } from "./failover.js";
5+
import { calculateBackoffDuration } from "./backoffDuration.js";
66

77
export class ConfigurationClientWrapper {
88
endpoint: string;

src/failover.ts renamed to src/backoffDuration.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ const MAX_BACKOFF_DURATION = 10 * 60 * 1000; // 10 minutes in milliseconds
66
const JITTER_RATIO = 0.25;
77

88
export function getFixedBackoffDuration(timeElapsed: number): number | undefined {
9-
if (timeElapsed <= 100_000) { // 100 seconds in milliseconds
9+
if (timeElapsed < 100_000) { // 100 seconds in milliseconds
1010
return 5_000; // 5 seconds in milliseconds
1111
}
12-
if (timeElapsed <= 200_000) { // 200 seconds in milliseconds
12+
if (timeElapsed < 200_000) { // 200 seconds in milliseconds
1313
return 10_000; // 10 seconds in milliseconds
1414
}
15-
if (timeElapsed <= 10 * 60 * 1000) { // 10 minutes in milliseconds
15+
if (timeElapsed < 10 * 60 * 1000) { // 10 minutes in milliseconds
1616
return MIN_BACKOFF_DURATION;
1717
}
1818
return undefined;

src/error.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ export function isFailoverableError(error: any): boolean {
5151
}
5252

5353
export function isRetriableError(error: any): boolean {
54-
if (isArgumentError(error) ||
55-
error instanceof RangeError) {
54+
if (isArgumentError(error)) {
5655
return false;
5756
}
5857
return true;
5958
}
6059

60+
/**
61+
* Check if the error is an instance of ArgumentError, TypeError, or RangeError.
62+
*/
6163
export function isArgumentError(error: any): boolean {
6264
if (error instanceof ArgumentError ||
6365
error instanceof TypeError ||

0 commit comments

Comments
 (0)