@cubejs-client/core 1.3.1 → 1.3.3
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/cubejs-client-core.esm.js +8 -3
- package/dist/cubejs-client-core.esm.js.map +1 -1
- package/dist/cubejs-client-core.js +8 -3
- package/dist/cubejs-client-core.js.map +1 -1
- package/dist/cubejs-client-core.umd.js +8 -3
- package/dist/cubejs-client-core.umd.js.map +1 -1
- package/index.d.ts +8 -0
- package/package.json +2 -2
- package/src/HttpTransport.js +4 -2
- package/src/index.js +8 -1
|
@@ -1261,13 +1261,15 @@ class HttpTransport {
|
|
|
1261
1261
|
apiUrl,
|
|
1262
1262
|
method,
|
|
1263
1263
|
headers = {},
|
|
1264
|
-
credentials
|
|
1264
|
+
credentials,
|
|
1265
|
+
fetchTimeout
|
|
1265
1266
|
}) {
|
|
1266
1267
|
this.authorization = authorization;
|
|
1267
1268
|
this.apiUrl = apiUrl;
|
|
1268
1269
|
this.method = method;
|
|
1269
1270
|
this.headers = headers;
|
|
1270
1271
|
this.credentials = credentials;
|
|
1272
|
+
this.fetchTimeout = fetchTimeout;
|
|
1271
1273
|
}
|
|
1272
1274
|
request(method, {
|
|
1273
1275
|
baseRequestId,
|
|
@@ -1297,7 +1299,8 @@ class HttpTransport {
|
|
|
1297
1299
|
...this.headers
|
|
1298
1300
|
},
|
|
1299
1301
|
credentials: this.credentials,
|
|
1300
|
-
body: requestMethod === 'POST' ? JSON.stringify(params) : null
|
|
1302
|
+
body: requestMethod === 'POST' ? JSON.stringify(params) : null,
|
|
1303
|
+
signal: this.fetchTimeout ? AbortSignal.timeout(this.fetchTimeout) : undefined
|
|
1301
1304
|
});
|
|
1302
1305
|
return {
|
|
1303
1306
|
/* eslint no-unsafe-finally: off */
|
|
@@ -1369,6 +1372,7 @@ class CubeApi {
|
|
|
1369
1372
|
this.pollInterval = options.pollInterval || 5;
|
|
1370
1373
|
this.parseDateMeasures = options.parseDateMeasures;
|
|
1371
1374
|
this.castNumerics = typeof options.castNumerics === 'boolean' ? options.castNumerics : false;
|
|
1375
|
+
this.networkErrorRetries = options.networkErrorRetries || 0;
|
|
1372
1376
|
this.updateAuthorizationPromise = null;
|
|
1373
1377
|
}
|
|
1374
1378
|
request(method, params) {
|
|
@@ -1401,6 +1405,7 @@ class CubeApi {
|
|
|
1401
1405
|
throw MUTEX_ERROR;
|
|
1402
1406
|
}
|
|
1403
1407
|
};
|
|
1408
|
+
let networkRetries = this.networkErrorRetries;
|
|
1404
1409
|
const loadImpl = async (response, next) => {
|
|
1405
1410
|
const requestInstance = await requestPromise;
|
|
1406
1411
|
const subscribeNext = async () => {
|
|
@@ -1427,7 +1432,7 @@ class CubeApi {
|
|
|
1427
1432
|
await this.updateTransportAuthorization();
|
|
1428
1433
|
}
|
|
1429
1434
|
skipAuthorizationUpdate = false;
|
|
1430
|
-
if (response.status === 502) {
|
|
1435
|
+
if (response.status === 502 || response.error && response.error.toLowerCase() === 'network error' && --networkRetries >= 0) {
|
|
1431
1436
|
await checkMutex();
|
|
1432
1437
|
return continueWait(true);
|
|
1433
1438
|
}
|