@mondaydotcomorg/monday-authorization 3.9.4-feat-shaime-fix-timeout-53ee888 → 3.9.4-feat-shaime-fix-timeout-a2bc003
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/dist/authorization-internal-service.d.ts +1 -0
- package/dist/authorization-internal-service.d.ts.map +1 -1
- package/dist/authorization-internal-service.js +24 -0
- package/dist/esm/authorization-internal-service.d.ts +1 -0
- package/dist/esm/authorization-internal-service.d.ts.map +1 -1
- package/dist/esm/authorization-internal-service.mjs +24 -1
- package/package.json +1 -1
- package/src/authorization-internal-service.ts +29 -16
|
@@ -9,6 +9,7 @@ export declare const logger: import("bunyan");
|
|
|
9
9
|
* Key used to retrieve retry configuration from Ignite.
|
|
10
10
|
*/
|
|
11
11
|
export declare const IGNITE_RETRY_CONFIG_KEY = "authorization_retry_config";
|
|
12
|
+
export declare const IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY = "authorization_new_retry_timeout_policy_enabled";
|
|
12
13
|
export declare const onRetryCallback: OnRetryCallback;
|
|
13
14
|
/**
|
|
14
15
|
* Exponential backoff retry delay callback
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-internal-service.d.ts","sourceRoot":"","sources":["../src/authorization-internal-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,eAAe,EACf,QAAQ,EACR,WAAW,EAEZ,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAGvE,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,MAAM,kBAA2B,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,uBAAuB,+BAA+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AyB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAIlE,MAAM,CAAC,sBAAsB,CAAC,wBAAwB,EAAE,yBAAyB;IAWjF,MAAM,CAAC,sBAAsB,IAAI,yBAAyB;IAI1D,MAAM,CAAC,wBAAwB;IAI/B,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY;IAI3C,MAAM,CAAC,iBAAiB;IA0BxB,MAAM,CAAC,gBAAgB,IAAI,WAAW;CAsCvC"}
|
|
@@ -31,6 +31,7 @@ const logger = MondayLogger__namespace.getLogger();
|
|
|
31
31
|
* Key used to retrieve retry configuration from Ignite.
|
|
32
32
|
*/
|
|
33
33
|
const IGNITE_RETRY_CONFIG_KEY = 'authorization_retry_config';
|
|
34
|
+
const IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY = 'authorization_new_retry_timeout_policy_enabled';
|
|
34
35
|
let igniteClient;
|
|
35
36
|
const defaultRetryConfig = {
|
|
36
37
|
retries: MAX_RETRIES,
|
|
@@ -70,6 +71,19 @@ function getRetryConfig() {
|
|
|
70
71
|
return defaultRetryConfig;
|
|
71
72
|
}
|
|
72
73
|
}
|
|
74
|
+
function isNewRetryTimeoutPolicyEnabled() {
|
|
75
|
+
if (!igniteClient) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
return igniteClient.isReleased(IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
logger.error({ tag: 'authorization-service', error, key: IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY }, 'Failed to get retry config feature flag from ignite, using defaults');
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const LEGACY_RETRY_DELAY_MS = 10;
|
|
73
87
|
function randomIntInclusive(min, max) {
|
|
74
88
|
if (max <= min) {
|
|
75
89
|
return min;
|
|
@@ -229,6 +243,15 @@ class AuthorizationInternalService {
|
|
|
229
243
|
}
|
|
230
244
|
static getRetriesPolicy() {
|
|
231
245
|
const fetchOptions = AuthorizationInternalService.getRequestFetchOptions();
|
|
246
|
+
// Feature-flag gate: when disabled, keep legacy retry policy behavior (as it was before this branch).
|
|
247
|
+
if (!isNewRetryTimeoutPolicyEnabled()) {
|
|
248
|
+
fetchOptions?.retries;
|
|
249
|
+
return {
|
|
250
|
+
useRetries: true,
|
|
251
|
+
maxRetries: 3,
|
|
252
|
+
retryDelayMS: LEGACY_RETRY_DELAY_MS,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
232
255
|
const retryConfig = getRetryConfig();
|
|
233
256
|
const statusMatchers = buildHttpStatusMatchers(retryConfig.retryOnStatusPatterns);
|
|
234
257
|
const defaultRetryOn = (_attempt, error, response, isTimeoutError) => {
|
|
@@ -255,6 +278,7 @@ class AuthorizationInternalService {
|
|
|
255
278
|
}
|
|
256
279
|
|
|
257
280
|
exports.AuthorizationInternalService = AuthorizationInternalService;
|
|
281
|
+
exports.IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY = IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY;
|
|
258
282
|
exports.IGNITE_RETRY_CONFIG_KEY = IGNITE_RETRY_CONFIG_KEY;
|
|
259
283
|
exports.MAX_RETRIES = MAX_RETRIES;
|
|
260
284
|
exports.RETRY_DELAY_MS = RETRY_DELAY_MS;
|
|
@@ -9,6 +9,7 @@ export declare const logger: import("bunyan");
|
|
|
9
9
|
* Key used to retrieve retry configuration from Ignite.
|
|
10
10
|
*/
|
|
11
11
|
export declare const IGNITE_RETRY_CONFIG_KEY = "authorization_retry_config";
|
|
12
|
+
export declare const IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY = "authorization_new_retry_timeout_policy_enabled";
|
|
12
13
|
export declare const onRetryCallback: OnRetryCallback;
|
|
13
14
|
/**
|
|
14
15
|
* Exponential backoff retry delay callback
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-internal-service.d.ts","sourceRoot":"","sources":["../../src/authorization-internal-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,eAAe,EACf,QAAQ,EACR,WAAW,EAEZ,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAGvE,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,MAAM,kBAA2B,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"authorization-internal-service.d.ts","sourceRoot":"","sources":["../../src/authorization-internal-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,eAAe,EACf,QAAQ,EACR,WAAW,EAEZ,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAGvE,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,MAAM,kBAA2B,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,2CAA2C,mDAAmD,CAAC;AA+J5G,eAAO,MAAM,eAAe,EAAE,eAkB7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,kBAAkB;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,KAAG,MAOlF,CAAC;AAIF,qBAAa,4BAA4B;IACvC,MAAM,KAAK,YAAY,IAAI,YAAY,GAAG,SAAS,CAElD;IAED,MAAM,KAAK,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,EAEvD;IACD,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAIpD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAIjD,MAAM,CAAC,+BAA+B,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAMlE,MAAM,CAAC,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAc5E,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK;IAQjE,MAAM,CAAC,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAIlE,MAAM,CAAC,sBAAsB,CAAC,wBAAwB,EAAE,yBAAyB;IAWjF,MAAM,CAAC,sBAAsB,IAAI,yBAAyB;IAI1D,MAAM,CAAC,wBAAwB;IAI/B,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY;IAI3C,MAAM,CAAC,iBAAiB;IA0BxB,MAAM,CAAC,gBAAgB,IAAI,WAAW;CAsCvC"}
|
|
@@ -9,6 +9,7 @@ const logger = MondayLogger.getLogger();
|
|
|
9
9
|
* Key used to retrieve retry configuration from Ignite.
|
|
10
10
|
*/
|
|
11
11
|
const IGNITE_RETRY_CONFIG_KEY = 'authorization_retry_config';
|
|
12
|
+
const IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY = 'authorization_new_retry_timeout_policy_enabled';
|
|
12
13
|
let igniteClient;
|
|
13
14
|
const defaultRetryConfig = {
|
|
14
15
|
retries: MAX_RETRIES,
|
|
@@ -48,6 +49,19 @@ function getRetryConfig() {
|
|
|
48
49
|
return defaultRetryConfig;
|
|
49
50
|
}
|
|
50
51
|
}
|
|
52
|
+
function isNewRetryTimeoutPolicyEnabled() {
|
|
53
|
+
if (!igniteClient) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
return igniteClient.isReleased(IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
logger.error({ tag: 'authorization-service', error, key: IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY }, 'Failed to get retry config feature flag from ignite, using defaults');
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const LEGACY_RETRY_DELAY_MS = 10;
|
|
51
65
|
function randomIntInclusive(min, max) {
|
|
52
66
|
if (max <= min) {
|
|
53
67
|
return min;
|
|
@@ -207,6 +221,15 @@ class AuthorizationInternalService {
|
|
|
207
221
|
}
|
|
208
222
|
static getRetriesPolicy() {
|
|
209
223
|
const fetchOptions = AuthorizationInternalService.getRequestFetchOptions();
|
|
224
|
+
// Feature-flag gate: when disabled, keep legacy retry policy behavior (as it was before this branch).
|
|
225
|
+
if (!isNewRetryTimeoutPolicyEnabled()) {
|
|
226
|
+
fetchOptions?.retries;
|
|
227
|
+
return {
|
|
228
|
+
useRetries: true,
|
|
229
|
+
maxRetries: 3,
|
|
230
|
+
retryDelayMS: LEGACY_RETRY_DELAY_MS,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
210
233
|
const retryConfig = getRetryConfig();
|
|
211
234
|
const statusMatchers = buildHttpStatusMatchers(retryConfig.retryOnStatusPatterns);
|
|
212
235
|
const defaultRetryOn = (_attempt, error, response, isTimeoutError) => {
|
|
@@ -232,4 +255,4 @@ class AuthorizationInternalService {
|
|
|
232
255
|
}
|
|
233
256
|
}
|
|
234
257
|
|
|
235
|
-
export { AuthorizationInternalService, IGNITE_RETRY_CONFIG_KEY, MAX_RETRIES, RETRY_DELAY_MS, calcDelayDurationInMs, logger, onRetryCallback };
|
|
258
|
+
export { AuthorizationInternalService, IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY, IGNITE_RETRY_CONFIG_KEY, MAX_RETRIES, RETRY_DELAY_MS, calcDelayDurationInMs, logger, onRetryCallback };
|
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@ export const logger = MondayLogger.getLogger();
|
|
|
20
20
|
* Key used to retrieve retry configuration from Ignite.
|
|
21
21
|
*/
|
|
22
22
|
export const IGNITE_RETRY_CONFIG_KEY = 'authorization_retry_config';
|
|
23
|
+
export const IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY = 'authorization_new_retry_timeout_policy_enabled';
|
|
23
24
|
|
|
24
25
|
let igniteClient: IgniteClient | undefined;
|
|
25
26
|
|
|
@@ -85,6 +86,23 @@ function getRetryConfig(): RetryConfig {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
89
|
+
function isNewRetryTimeoutPolicyEnabled(): boolean {
|
|
90
|
+
if (!igniteClient) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
return igniteClient.isReleased(IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
logger.error(
|
|
97
|
+
{ tag: 'authorization-service', error, key: IGNITE_NEW_RETRY_TIMEOUT_POLICY_ENABLED_KEY },
|
|
98
|
+
'Failed to get retry config feature flag from ignite, using defaults'
|
|
99
|
+
);
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const LEGACY_RETRY_DELAY_MS = 10;
|
|
105
|
+
|
|
88
106
|
function randomIntInclusive(min: number, max: number): number {
|
|
89
107
|
if (max <= min) {
|
|
90
108
|
return min;
|
|
@@ -161,22 +179,6 @@ function buildHttpStatusMatchers(patterns: string[]): StatusMatcher[] {
|
|
|
161
179
|
return matchers;
|
|
162
180
|
}
|
|
163
181
|
|
|
164
|
-
/**
|
|
165
|
-
* Determines if a request should be retried based on the response status.
|
|
166
|
-
* @param responseOrStatus The response object or null/undefined
|
|
167
|
-
* @param statusMatchers Array of matchers to check against
|
|
168
|
-
*/
|
|
169
|
-
function shouldRetryOnResponseStatus(
|
|
170
|
-
responseOrStatus: Response | null | undefined,
|
|
171
|
-
statusMatchers: StatusMatcher[]
|
|
172
|
-
): boolean {
|
|
173
|
-
const status = responseOrStatus?.status;
|
|
174
|
-
if (typeof status !== 'number') {
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
return statusMatchers.some(matcher => matcher(status));
|
|
178
|
-
}
|
|
179
|
-
|
|
180
182
|
export const onRetryCallback: OnRetryCallback = (
|
|
181
183
|
attempt: number,
|
|
182
184
|
error?: NullableErrorWithType,
|
|
@@ -312,6 +314,17 @@ export class AuthorizationInternalService {
|
|
|
312
314
|
|
|
313
315
|
static getRetriesPolicy(): RetryPolicy {
|
|
314
316
|
const fetchOptions = AuthorizationInternalService.getRequestFetchOptions();
|
|
317
|
+
|
|
318
|
+
// Feature-flag gate: when disabled, keep legacy retry policy behavior (as it was before this branch).
|
|
319
|
+
if (!isNewRetryTimeoutPolicyEnabled()) {
|
|
320
|
+
const retries = fetchOptions?.retries;
|
|
321
|
+
return {
|
|
322
|
+
useRetries: true,
|
|
323
|
+
maxRetries: 3,
|
|
324
|
+
retryDelayMS: LEGACY_RETRY_DELAY_MS,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
|
|
315
328
|
const retryConfig = getRetryConfig();
|
|
316
329
|
const statusMatchers = buildHttpStatusMatchers(retryConfig.retryOnStatusPatterns);
|
|
317
330
|
const defaultRetryOn = (_attempt, error, response, isTimeoutError) => {
|