From 493b4ecfdea2c29027a442b2720e9ae22e88112c Mon Sep 17 00:00:00 2001 From: Alexandre Bourdin Date: Tue, 7 Dec 2021 17:13:21 +0100 Subject: [PATCH] Merge pull request #6029 from overleaf/ab-docstore-socket-leak Set timeout values on docstore server GitOrigin-RevId: ea7a29532e53964b5b66367617e797160711c063 --- services/docstore/.gitignore | 3 +++ services/docstore/app.js | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/services/docstore/.gitignore b/services/docstore/.gitignore index 80bac793a7..84bf300f7f 100644 --- a/services/docstore/.gitignore +++ b/services/docstore/.gitignore @@ -3,3 +3,6 @@ forever # managed by dev-environment$ bin/update_build_scripts .npmrc + +# Jetbrains IDEs +.idea diff --git a/services/docstore/app.js b/services/docstore/app.js index 75154471be..fa6771ca53 100644 --- a/services/docstore/app.js +++ b/services/docstore/app.js @@ -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', HttpController.getAllDocs) app.get('/project/:project_id/ranges', HttpController.getAllRanges) @@ -106,13 +104,17 @@ if (!module.parent) { mongodb .waitForDb() .then(() => { - app.listen(port, host, function (err) { + const server = app.listen(port, host, function (err) { if (err) { logger.fatal({ err }, `Cannot bind to ${host}:${port}. Exiting.`) process.exit(1) } return logger.info(`Docstore starting up, listening on ${host}:${port}`) }) + server.timeout = 120000 + server.keepAliveTimeout = 5000 + server.requestTimeout = 60000 + server.headersTimeout = 60000 }) .catch(err => { logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')