Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: increase timeouts for GUI server #265

Merged
merged 1 commit into from
Sep 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а почему тут 125?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@xrsd xrsd Sep 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я, кстати, забыл отписаться в тикете, что пробовал поставить KEEP_ALIVE_TIMEOUT для сервера ровно в то же значение, что и ты – и безрезультатно. А вот HEADERS_TIMEOUT не пробовал задавать.

Так ты проверил? Помогло? Если помогло, то явно не keep-alive-timeout

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я понял – оказывается, я пытался устанавливать это значения для сервера express, а так не работает, надо делать как ниже.

};
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