Merge pull request #6029 from overleaf/ab-docstore-socket-leak

Set timeout values on docstore server

GitOrigin-RevId: ea7a29532e53964b5b66367617e797160711c063
This commit is contained in:
Alexandre Bourdin 2021-12-07 17:13:21 +01:00 committed by Copybot
parent 1fd0a26d29
commit 493b4ecfde
2 changed files with 8 additions and 3 deletions

View file

@ -3,3 +3,6 @@ forever
# managed by dev-environment$ bin/update_build_scripts # managed by dev-environment$ bin/update_build_scripts
.npmrc .npmrc
# Jetbrains IDEs
.idea

View file

@ -46,8 +46,6 @@ app.param('doc_id', function (req, res, next, docId) {
} }
}) })
Metrics.injectMetricsRoute(app)
app.get('/project/:project_id/doc-deleted', HttpController.getAllDeletedDocs) app.get('/project/:project_id/doc-deleted', HttpController.getAllDeletedDocs)
app.get('/project/:project_id/doc', HttpController.getAllDocs) app.get('/project/:project_id/doc', HttpController.getAllDocs)
app.get('/project/:project_id/ranges', HttpController.getAllRanges) app.get('/project/:project_id/ranges', HttpController.getAllRanges)
@ -106,13 +104,17 @@ if (!module.parent) {
mongodb mongodb
.waitForDb() .waitForDb()
.then(() => { .then(() => {
app.listen(port, host, function (err) { const server = app.listen(port, host, function (err) {
if (err) { if (err) {
logger.fatal({ err }, `Cannot bind to ${host}:${port}. Exiting.`) logger.fatal({ err }, `Cannot bind to ${host}:${port}. Exiting.`)
process.exit(1) process.exit(1)
} }
return logger.info(`Docstore starting up, listening on ${host}:${port}`) return logger.info(`Docstore starting up, listening on ${host}:${port}`)
}) })
server.timeout = 120000
server.keepAliveTimeout = 5000
server.requestTimeout = 60000
server.headersTimeout = 60000
}) })
.catch(err => { .catch(err => {
logger.fatal({ err }, 'Cannot connect to mongo. Exiting.') logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')