From 7db9e73ecf8e0235166726d8db9629e101ffee51 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 14 Oct 2019 10:17:07 +0100 Subject: [PATCH] Merge pull request #2234 from overleaf/bg-avoid-event-loop-metrics-during-startup start event loop monitoring when the process is ready GitOrigin-RevId: 0a7759311b737e99579f61cc4cf90b775c26b76d --- services/web/app.js | 2 ++ services/web/app/src/infrastructure/Server.js | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/services/web/app.js b/services/web/app.js index 819ad05c12..cf021ab984 100644 --- a/services/web/app.js +++ b/services/web/app.js @@ -49,6 +49,8 @@ if (!module.parent) { Server.server.listen(port, host, function() { logger.info(`web starting up, listening on ${host}:${port}`) logger.info(`${require('http').globalAgent.maxSockets} sockets enabled`) + // wait until the process is ready before monitoring the event loop + metrics.event_loop.monitor(logger) if (argv.user) { process.setuid(argv.user) logger.info(`Running as user: ${argv.user}`) diff --git a/services/web/app/src/infrastructure/Server.js b/services/web/app/src/infrastructure/Server.js index 428d1206f5..f8cdefd8dd 100644 --- a/services/web/app/src/infrastructure/Server.js +++ b/services/web/app/src/infrastructure/Server.js @@ -42,10 +42,6 @@ const STATIC_CACHE_AGE = Settings.cacheStaticAssets // Init the session store const sessionStore = new RedisStore({ client: sessionsRedisClient }) -if (metrics.event_loop != null) { - metrics.event_loop.monitor(logger) -} - const app = express() const webRouter = express.Router()