@aloma.io/integration-sdk 3.3.60 → 3.3.62
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/build/internal/index.mjs
CHANGED
@@ -100,6 +100,10 @@ class Fetcher {
|
|
100
100
|
return unwrap(ret, options);
|
101
101
|
}
|
102
102
|
catch (e) {
|
103
|
+
// too many requests
|
104
|
+
if (e.status === 429) {
|
105
|
+
return local.onError(e, url, options, retries, args, true);
|
106
|
+
}
|
103
107
|
--retries;
|
104
108
|
console.log(theURL, e);
|
105
109
|
if (retries <= 0)
|
@@ -132,7 +136,7 @@ class OAuthFetcher extends Fetcher {
|
|
132
136
|
throw new Error("could not obtain access token via refresh token");
|
133
137
|
}
|
134
138
|
}
|
135
|
-
async onError(e, url, options, retries, args) {
|
139
|
+
async onError(e, url, options, retries, args, rateLimit) {
|
136
140
|
var local = this;
|
137
141
|
return new Promise((resolve, reject) => {
|
138
142
|
setTimeout(async () => {
|
@@ -144,7 +148,7 @@ class OAuthFetcher extends Fetcher {
|
|
144
148
|
catch (e) {
|
145
149
|
reject(e);
|
146
150
|
}
|
147
|
-
}, 500);
|
151
|
+
}, rateLimit ? 10000 : 500);
|
148
152
|
});
|
149
153
|
}
|
150
154
|
async periodicRefresh() {
|
package/package.json
CHANGED
package/src/internal/index.mjs
CHANGED
@@ -128,6 +128,11 @@ class Fetcher {
|
|
128
128
|
|
129
129
|
return unwrap(ret, options);
|
130
130
|
} catch (e) {
|
131
|
+
// too many requests
|
132
|
+
if (e.status === 429) {
|
133
|
+
return local.onError(e, url, options, retries, args, true);
|
134
|
+
}
|
135
|
+
|
131
136
|
--retries;
|
132
137
|
|
133
138
|
console.log(theURL, e);
|
@@ -170,7 +175,7 @@ class OAuthFetcher extends Fetcher {
|
|
170
175
|
}
|
171
176
|
}
|
172
177
|
|
173
|
-
async onError(e, url, options, retries, args) {
|
178
|
+
async onError(e, url, options, retries, args, rateLimit) {
|
174
179
|
var local = this;
|
175
180
|
|
176
181
|
return new Promise((resolve, reject) => {
|
@@ -184,7 +189,7 @@ class OAuthFetcher extends Fetcher {
|
|
184
189
|
} catch (e) {
|
185
190
|
reject(e);
|
186
191
|
}
|
187
|
-
}, 500);
|
192
|
+
}, rateLimit?10000:500);
|
188
193
|
});
|
189
194
|
}
|
190
195
|
|