CartoDB-SQL-API/app/middlewares/socket-timeout.js
Daniel García Aubert 92ba322214 Linter
2019-10-01 15:42:24 +02:00

19 lines
472 B
JavaScript

'use strict';
module.exports = function socketTimeout () {
if (!global.settings.hasOwnProperty('node_socket_timeout')) {
return function dummySocketTimeoutMiddleware (req, res, next) {
next();
};
}
const timeout = parseInt(global.settings.node_socket_timeout);
return function socketTimeoutMiddleware (req, res, next) {
// Set connection timeout
req.connection.setTimeout(timeout);
next();
};
};