From 8d343fae6d2c1aa8d2822aa44c45db6ac442db5d Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 28 Aug 2021 17:30:59 -0700 Subject: [PATCH] fix: Enforce single process for collaboration --- server/index.js | 9 +++++++-- server/services/collaboration.js | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/server/index.js b/server/index.js index ca3610b18d..3552e66c3a 100644 --- a/server/index.js +++ b/server/index.js @@ -84,8 +84,13 @@ async function start() { throng({ worker: start, - // The number of workers to run, defaults to the number of CPU's available - count: process.env.WEB_CONCURRENCY || undefined, + // The number of processes to run, defaults to the number of CPU's available + // for the web service, and 1 for collaboration during the beta period. + count: serviceNames.includes("web") + ? process.env.WEB_CONCURRENCY || undefined + : serviceNames.includes("collaboration") + ? 1 + : undefined, }); if (env.ENABLE_UPDATES !== "false" && process.env.NODE_ENV === "production") { diff --git a/server/services/collaboration.js b/server/services/collaboration.js index c2b36b76f2..ff2886d22e 100644 --- a/server/services/collaboration.js +++ b/server/services/collaboration.js @@ -28,8 +28,7 @@ export default function init(app: Koa, server: http.Server) { hocuspocus.handleConnection(ws, ctx.request, documentName); } - ctx.body = "this is a websocket route"; - ctx.response.status = 400; + ctx.response.status = 101; }); app.use(websocket());