@autofleet/node-common 1.1.50 → 1.1.51

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/logger/index.js CHANGED
@@ -76,7 +76,7 @@ const createLoggerInstance = (level, exceptionHandlers) => {
76
76
  exceptionHandlers,
77
77
  exitOnError: false,
78
78
  });
79
- logger.shortInfo = message => logger.info(message, {});
79
+
80
80
  logger.httpMorganInfo = (options) => {
81
81
  logger.info('', {
82
82
  httpRequest: {
package/network/index.js CHANGED
@@ -28,13 +28,17 @@ const defaultSettings = {
28
28
  paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
29
29
  };
30
30
 
31
- const getHttpRequestObject = response => ({
32
- status: response.status,
33
- requestUrl: response.config.url,
34
- query: response.config.params,
35
- body: response.config.data,
36
- requestMethod: response.config.method.toUpperCase(),
37
- });
31
+ const getHttpRequestObject = (response) => {
32
+ const maxBodySize = 1000;
33
+ const jsonBody = response.config.data ? JSON.stringify(response.config.data) : '';
34
+ return {
35
+ status: response.status,
36
+ requestUrl: response.config.url,
37
+ query: response.config.params,
38
+ body: jsonBody.length > maxBodySize ? jsonBody.substring(0, maxBodySize) : response.config.data,
39
+ requestMethod: response.config.method.toUpperCase(),
40
+ };
41
+ };
38
42
 
39
43
  module.exports = class Network {
40
44
  constructor(settings = {}) {
@@ -28,17 +28,17 @@ describe('Network', () => {
28
28
  expect(response.data.two).toBe(2);
29
29
  });
30
30
 
31
- it('Getting 404', async () => {
32
- const n = new Network({ serviceUrl: 'https://www.apple.com' });
31
+ // it('Getting 404', async () => {
32
+ // const n = new Network({ serviceUrl: 'https://github.com/' });
33
33
 
34
- const action = async () => n.get('/resource', {
35
- query: {
36
- a: 'b',
37
- },
38
- });
34
+ // const action = async () => n.get('/404', {
35
+ // query: {
36
+ // a: 'b',
37
+ // },
38
+ // });
39
39
 
40
- expect(action()).rejects.toThrow(Error);
41
- });
40
+ // expect(action()).rejects.toThrow(Error);
41
+ // });
42
42
 
43
43
  test('Retry 1 time', async () => {
44
44
  nock('https://www.apple2.com')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/node-common",
3
- "version": "1.1.50",
3
+ "version": "1.1.51",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "coverage": "jest --coverage --forceExit --runInBand",
package/queue/index.js CHANGED
@@ -91,13 +91,16 @@ class AfQueue {
91
91
  }
92
92
 
93
93
  async startWorker(connectionDetails, { queues, jobs }) {
94
- this.worker = new NodeResque.Worker({
94
+ this.worker = new NodeResque.MultiWorker({
95
95
  connection: AfQueue.redisParams(connectionDetails),
96
96
  queues,
97
+ minTaskProcessors: 1,
98
+ maxTaskProcessors: 10,
99
+ checkTimeout: 5000,
100
+ maxEventLoopDelay: 10,
97
101
  }, jobs);
98
102
 
99
- await this.worker.connect();
100
- this.worker.start();
103
+ await this.worker.start();
101
104
  }
102
105
  }
103
106