@friggframework/core 2.0.0--canary.623.1559ce4.0 → 2.0.0--canary.623.ce8e6ae.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,7 @@ class Requester extends Delegate {
|
|
|
61
61
|
return resp.text();
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
async _request(url, options,
|
|
64
|
+
async _request(url, options, attempt = 0) {
|
|
65
65
|
let encodedUrl = encodeURI(url);
|
|
66
66
|
if (options.query) {
|
|
67
67
|
let queryBuild = '?';
|
|
@@ -119,11 +119,11 @@ class Requester extends Delegate {
|
|
|
119
119
|
// stall at batch scale.
|
|
120
120
|
const isTimeout =
|
|
121
121
|
e?.name === 'AbortError' || e?.type === 'aborted';
|
|
122
|
-
if (e?.code === 'ECONNRESET' &&
|
|
122
|
+
if (e?.code === 'ECONNRESET' && attempt < this.backOff.length) {
|
|
123
123
|
clearRequestTimer();
|
|
124
|
-
const delay = this.backOff[
|
|
124
|
+
const delay = this.backOff[attempt] * 1000;
|
|
125
125
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
126
|
-
return this._request(url, options,
|
|
126
|
+
return this._request(url, options, attempt + 1);
|
|
127
127
|
}
|
|
128
128
|
const fetchError = await FetchError.create({
|
|
129
129
|
resource: encodedUrl,
|
|
@@ -146,11 +146,14 @@ class Requester extends Delegate {
|
|
|
146
146
|
const { status } = response;
|
|
147
147
|
|
|
148
148
|
// If the status is retriable and there are back off requests left, retry the request
|
|
149
|
-
if (
|
|
149
|
+
if (
|
|
150
|
+
(status === 429 || status >= 500) &&
|
|
151
|
+
attempt < this.backOff.length
|
|
152
|
+
) {
|
|
150
153
|
clearRequestTimer();
|
|
151
|
-
const delay = this.backOff[
|
|
154
|
+
const delay = this.backOff[attempt] * 1000;
|
|
152
155
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
153
|
-
return this._request(url, options,
|
|
156
|
+
return this._request(url, options, attempt + 1);
|
|
154
157
|
}
|
|
155
158
|
|
|
156
159
|
if (status === 401) {
|
|
@@ -164,7 +167,7 @@ class Requester extends Delegate {
|
|
|
164
167
|
await new Promise((resolve) =>
|
|
165
168
|
setTimeout(resolve, delay)
|
|
166
169
|
);
|
|
167
|
-
return this._request(url, options,
|
|
170
|
+
return this._request(url, options, attempt + 1);
|
|
168
171
|
}
|
|
169
172
|
|
|
170
173
|
throw await this._invalidateAuth(
|
|
@@ -179,7 +182,7 @@ class Requester extends Delegate {
|
|
|
179
182
|
const refreshSucceeded = await this.refreshAuth();
|
|
180
183
|
if (refreshSucceeded) {
|
|
181
184
|
clearRequestTimer();
|
|
182
|
-
return this._request(url, options,
|
|
185
|
+
return this._request(url, options, attempt + 1);
|
|
183
186
|
}
|
|
184
187
|
|
|
185
188
|
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.ce8e6ae.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.ce8e6ae.0",
|
|
42
|
+
"@friggframework/prettier-config": "2.0.0--canary.623.ce8e6ae.0",
|
|
43
|
+
"@friggframework/test": "2.0.0--canary.623.ce8e6ae.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": "ce8e6ae7f60121290cc48fd3f36653fd18790204"
|
|
84
84
|
}
|