CartoDB-SQL-API/lib/api/middlewares/socket-timeout.js
Daniel García Aubert 1e413a9332 Eslint errors
2019-12-26 18:28:01 +01:00

19 lines
495 B
JavaScript

'use strict';
module.exports = function socketTimeout () {
if (!Object.prototype.hasOwnProperty.call(global.settings, '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();
};
};