@azteam/express 1.2.458 → 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 +10 -3
- package/package.json +1 -1
- package/src/Server.js +7 -2
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] :
|
|
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,7 +354,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
349
354
|
});
|
|
350
355
|
});
|
|
351
356
|
var server = _http["default"].Server(app);
|
|
352
|
-
server.setTimeout(
|
|
357
|
+
server.setTimeout(this.options.timeout);
|
|
358
|
+
server.keepAliveTimeout = this.options.keepAliveTimeout;
|
|
359
|
+
server.headersTimeout = this.options.keepAliveTimeout;
|
|
353
360
|
server.on('listening', function () {
|
|
354
361
|
_this4._alert('listening', "Server start at http://localhost:".concat(server.address().port));
|
|
355
362
|
});
|
package/package.json
CHANGED
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 =
|
|
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,7 +328,9 @@ class Server {
|
|
|
325
328
|
});
|
|
326
329
|
|
|
327
330
|
const server = http.Server(app);
|
|
328
|
-
server.setTimeout(
|
|
331
|
+
server.setTimeout(this.options.timeout);
|
|
332
|
+
server.keepAliveTimeout = this.options.keepAliveTimeout;
|
|
333
|
+
server.headersTimeout = this.options.keepAliveTimeout;
|
|
329
334
|
|
|
330
335
|
server.on('listening', () => {
|
|
331
336
|
this._alert('listening', `Server start at http://localhost:${server.address().port}`);
|