Skip to content

Commit

Permalink
fix: increase timeouts for GUI server
Browse files Browse the repository at this point in the history
fix for error 'net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)' on slow '/init' request.
  • Loading branch information
CatWithApple committed Sep 23, 2019
1 parent e3bb988 commit 0cae66a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/gui/constants/server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

module.exports = {
MAX_REQUEST_SIZE: '100mb'
MAX_REQUEST_SIZE: '100mb',
KEEP_ALIVE_TIMEOUT: 120 * 1000,
HEADERS_TIMEOUT: 125 * 1000
};
6 changes: 4 additions & 2 deletions lib/gui/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const onExit = require('signal-exit');
const Promise = require('bluebird');
const bodyParser = require('body-parser');
const App = require('./app');
const {MAX_REQUEST_SIZE} = require('./constants/server');
const {MAX_REQUEST_SIZE, KEEP_ALIVE_TIMEOUT, HEADERS_TIMEOUT} = require('./constants/server');
const {logger} = require('../server-utils');

exports.start = ({paths, tool, guiApi, configs}) => {
Expand Down Expand Up @@ -70,7 +70,9 @@ exports.start = ({paths, tool, guiApi, configs}) => {
return app.initialize()
.then(() => {
return Promise.fromCallback((callback) => {
server.listen(options.port, options.hostname, callback);
const httpServer = server.listen(options.port, options.hostname, callback);
httpServer.keepAliveTimeout = KEEP_ALIVE_TIMEOUT;
httpServer.headersTimeout = HEADERS_TIMEOUT;
});
})
.then(() => {
Expand Down

0 comments on commit 0cae66a

Please sign in to comment.