@autofleet/network 1.2.9-alpha-10 → 1.2.9-alpha-12
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/index.js +11 -4
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const axios = require('axios');
|
|
2
2
|
const axiosRetry = require('axios-retry');
|
|
3
|
-
const
|
|
3
|
+
const Logger = require('@autofleet/logger');
|
|
4
4
|
const qs = require('qs');
|
|
5
5
|
const httpAdapter = require('axios/lib/adapters/http');
|
|
6
6
|
const merge = require('deepmerge');
|
|
@@ -97,9 +97,16 @@ module.exports = class Network {
|
|
|
97
97
|
logger.info(`Finish Request: [${response.config.method.toUpperCase()} ${response.config.url}`);
|
|
98
98
|
return response;
|
|
99
99
|
}, (error) => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
if(error.request._currentRequest.reusedSocket && error.code === 'ECONNRESET') {
|
|
101
|
+
// See https://www.npmjs.com/package/agentkeepalive
|
|
102
|
+
// Support req.reusedSocket
|
|
103
|
+
// https://code-examples.net/en/q/28a8069
|
|
104
|
+
logger.warn('ECONNRESET issue, will retry', {
|
|
105
|
+
req: error.request,
|
|
106
|
+
code: error.code,
|
|
107
|
+
})
|
|
108
|
+
return axios.request(error.config);
|
|
109
|
+
}
|
|
103
110
|
logger.error('Finish Request with error', { status: error.status, data: error.response && error.response.data });
|
|
104
111
|
throw error;
|
|
105
112
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autofleet/network",
|
|
3
|
-
"version": "1.2.9-alpha-
|
|
3
|
+
"version": "1.2.9-alpha-12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"author": "Dor Shay",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
|
+
"@autofleet/logger": "^1.2.3",
|
|
14
15
|
"@autofleet/node-common": "^1.5.1",
|
|
15
16
|
"agentkeepalive": "^4.1.4",
|
|
16
17
|
"axios": "^0.21.1",
|