@friggframework/core 2.0.0--canary.623.1559ce4.0 → 2.0.0--canary.623.0155fc6.0
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.
|
@@ -61,7 +61,12 @@ class Requester extends Delegate {
|
|
|
61
61
|
return resp.text();
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
/**
|
|
65
|
+
* @param {number} attempt - 0-based count of retries already made for
|
|
66
|
+
* this call. Indexes `this.backOff` for the next delay and is passed
|
|
67
|
+
* back in on each recursive retry.
|
|
68
|
+
*/
|
|
69
|
+
async _request(url, options, attempt = 0) {
|
|
65
70
|
let encodedUrl = encodeURI(url);
|
|
66
71
|
if (options.query) {
|
|
67
72
|
let queryBuild = '?';
|
|
@@ -119,11 +124,11 @@ class Requester extends Delegate {
|
|
|
119
124
|
// stall at batch scale.
|
|
120
125
|
const isTimeout =
|
|
121
126
|
e?.name === 'AbortError' || e?.type === 'aborted';
|
|
122
|
-
if (e?.code === 'ECONNRESET' &&
|
|
127
|
+
if (e?.code === 'ECONNRESET' && attempt < this.backOff.length) {
|
|
123
128
|
clearRequestTimer();
|
|
124
|
-
const delay = this.backOff[
|
|
129
|
+
const delay = this.backOff[attempt] * 1000;
|
|
125
130
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
126
|
-
return this._request(url, options,
|
|
131
|
+
return this._request(url, options, attempt + 1);
|
|
127
132
|
}
|
|
128
133
|
const fetchError = await FetchError.create({
|
|
129
134
|
resource: encodedUrl,
|
|
@@ -146,11 +151,14 @@ class Requester extends Delegate {
|
|
|
146
151
|
const { status } = response;
|
|
147
152
|
|
|
148
153
|
// If the status is retriable and there are back off requests left, retry the request
|
|
149
|
-
if (
|
|
154
|
+
if (
|
|
155
|
+
(status === 429 || status >= 500) &&
|
|
156
|
+
attempt < this.backOff.length
|
|
157
|
+
) {
|
|
150
158
|
clearRequestTimer();
|
|
151
|
-
const delay = this.backOff[
|
|
159
|
+
const delay = this.backOff[attempt] * 1000;
|
|
152
160
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
153
|
-
return this._request(url, options,
|
|
161
|
+
return this._request(url, options, attempt + 1);
|
|
154
162
|
}
|
|
155
163
|
|
|
156
164
|
if (status === 401) {
|
|
@@ -164,7 +172,7 @@ class Requester extends Delegate {
|
|
|
164
172
|
await new Promise((resolve) =>
|
|
165
173
|
setTimeout(resolve, delay)
|
|
166
174
|
);
|
|
167
|
-
return this._request(url, options,
|
|
175
|
+
return this._request(url, options, attempt + 1);
|
|
168
176
|
}
|
|
169
177
|
|
|
170
178
|
throw await this._invalidateAuth(
|
|
@@ -179,7 +187,7 @@ class Requester extends Delegate {
|
|
|
179
187
|
const refreshSucceeded = await this.refreshAuth();
|
|
180
188
|
if (refreshSucceeded) {
|
|
181
189
|
clearRequestTimer();
|
|
182
|
-
return this._request(url, options,
|
|
190
|
+
return this._request(url, options, attempt + 1);
|
|
183
191
|
}
|
|
184
192
|
|
|
185
193
|
throw await this._invalidateAuth(
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/core",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.623.
|
|
4
|
+
"version": "2.0.0--canary.623.0155fc6.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.588.0",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@friggframework/eslint-config": "2.0.0--canary.623.
|
|
42
|
-
"@friggframework/prettier-config": "2.0.0--canary.623.
|
|
43
|
-
"@friggframework/test": "2.0.0--canary.623.
|
|
41
|
+
"@friggframework/eslint-config": "2.0.0--canary.623.0155fc6.0",
|
|
42
|
+
"@friggframework/prettier-config": "2.0.0--canary.623.0155fc6.0",
|
|
43
|
+
"@friggframework/test": "2.0.0--canary.623.0155fc6.0",
|
|
44
44
|
"@prisma/client": "^6.19.3",
|
|
45
45
|
"@types/lodash": "4.17.15",
|
|
46
46
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "0155fc63dbd76e4e6fad4f53abdbbf9b18f7c6bd"
|
|
84
84
|
}
|