@azteam/express 1.2.459 → 1.2.461

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/lib/Server.js CHANGED
@@ -49,14 +49,19 @@ var Server = /*#__PURE__*/function () {
49
49
  function Server(serviceDirs) {
50
50
  var _this = this;
51
51
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52
- var errorCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
52
+ var errorCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
53
53
  _classCallCheck(this, Server);
54
54
  this.options = _objectSpread(_objectSpread({
55
55
  redis: null,
56
56
  whiteList: null,
57
57
  excludeList: [],
58
58
  debug: process.env.NODE_ENV === 'development',
59
- systemUser: 'toda'
59
+ systemUser: 'toda',
60
+ timeout: 300 * 1000,
61
+ // 5 minutes
62
+ keepAliveTimeout: 300 * 1000,
63
+ // 300 seconds
64
+ headersTimeout: 305 * 1000
60
65
  }, options), {}, {
61
66
  cookieOption: _objectSpread({
62
67
  domain: null,
@@ -349,9 +354,9 @@ var Server = /*#__PURE__*/function () {
349
354
  });
350
355
  });
351
356
  var server = _http["default"].Server(app);
352
- server.setTimeout(300 * 1000);
353
- server.keepAliveTimeout = 30 * 1000;
354
- server.headersTimeout = 35 * 1000;
357
+ server.setTimeout(this.options.timeout);
358
+ server.keepAliveTimeout = this.options.keepAliveTimeout;
359
+ server.headersTimeout = this.options.keepAliveTimeout;
355
360
  server.on('listening', function () {
356
361
  _this4._alert('listening', "Server start at http://localhost:".concat(server.address().port));
357
362
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azteam/express",
3
- "version": "1.2.459",
3
+ "version": "1.2.461",
4
4
  "license": "MIT",
5
5
  "author": "toda <sp.azsolution.net@gmail.com>",
6
6
  "main": "./lib/index.js",
package/src/Server.js CHANGED
@@ -24,13 +24,16 @@ const RES_TYPE = {
24
24
  };
25
25
 
26
26
  class Server {
27
- constructor(serviceDirs, options = {}, errorCallback = null) {
27
+ constructor(serviceDirs, options = {}, errorCallback = () => {}) {
28
28
  this.options = {
29
29
  redis: null,
30
30
  whiteList: null,
31
31
  excludeList: [],
32
32
  debug: process.env.NODE_ENV === 'development',
33
33
  systemUser: 'toda',
34
+ timeout: 300 * 1000, // 5 minutes
35
+ keepAliveTimeout: 300 * 1000, // 300 seconds
36
+ headersTimeout: 305 * 1000, // 305 seconds
34
37
  ...options,
35
38
  cookieOption: {
36
39
  domain: null,
@@ -325,9 +328,9 @@ class Server {
325
328
  });
326
329
 
327
330
  const server = http.Server(app);
328
- server.setTimeout(300 * 1000);
329
- server.keepAliveTimeout = 30 * 1000;
330
- server.headersTimeout = 35 * 1000;
331
+ server.setTimeout(this.options.timeout);
332
+ server.keepAliveTimeout = this.options.keepAliveTimeout;
333
+ server.headersTimeout = this.options.keepAliveTimeout;
331
334
 
332
335
  server.on('listening', () => {
333
336
  this._alert('listening', `Server start at http://localhost:${server.address().port}`);