fix: Queue health monitor should only run on worker processes (#6228)
This commit is contained in:
@@ -10,7 +10,6 @@ import Koa from "koa";
|
||||
import helmet from "koa-helmet";
|
||||
import logger from "koa-logger";
|
||||
import Router from "koa-router";
|
||||
import uniq from "lodash/uniq";
|
||||
import { AddressInfo } from "net";
|
||||
import stoppable from "stoppable";
|
||||
import throng from "throng";
|
||||
@@ -27,17 +26,11 @@ import { checkConnection, sequelize } from "./storage/database";
|
||||
import RedisAdapter from "./storage/redis";
|
||||
import Metrics from "./logging/Metrics";
|
||||
|
||||
// The default is to run all services to make development and OSS installations
|
||||
// easier to deal with. Separate services are only needed at scale.
|
||||
const serviceNames = uniq(
|
||||
env.SERVICES.split(",").map((service) => service.trim())
|
||||
);
|
||||
|
||||
// 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.
|
||||
let processCount = env.WEB_CONCURRENCY;
|
||||
|
||||
if (serviceNames.includes("collaboration")) {
|
||||
if (env.SERVICES.includes("collaboration")) {
|
||||
if (processCount !== 1) {
|
||||
Logger.info(
|
||||
"lifecycle",
|
||||
@@ -114,14 +107,14 @@ async function start(id: number, disconnect: () => void) {
|
||||
app.use(router.routes());
|
||||
|
||||
// loop through requested services at startup
|
||||
for (const name of serviceNames) {
|
||||
for (const name of env.SERVICES) {
|
||||
if (!Object.keys(services).includes(name)) {
|
||||
throw new Error(`Unknown service ${name}`);
|
||||
}
|
||||
|
||||
Logger.info("lifecycle", `Starting ${name} service`);
|
||||
const init = services[name];
|
||||
await init(app, server, serviceNames);
|
||||
await init(app, server, env.SERVICES);
|
||||
}
|
||||
|
||||
server.on("error", (err) => {
|
||||
|
||||
Reference in New Issue
Block a user