feat: allow horizontal scaling
This commit is contained in:
parent
3897adaed7
commit
6a5b9009f0
@ -124,6 +124,9 @@ reservedUsernames: [
|
||||
# Number of worker processes
|
||||
#clusterLimit: 1
|
||||
|
||||
# Worker only mode
|
||||
#onlyQueueProcessor: 1
|
||||
|
||||
# Job concurrency per worker
|
||||
# deliverJobConcurrency: 128
|
||||
# inboxJobConcurrency: 16
|
||||
|
@ -93,7 +93,7 @@ export async function masterMain() {
|
||||
true,
|
||||
);
|
||||
|
||||
if (!envOption.noDaemons) {
|
||||
if (!envOption.noDaemons && !config.onlyQueueProcessor) {
|
||||
import("../daemons/server-stats.js").then((x) => x.default());
|
||||
import("../daemons/queue-stats.js").then((x) => x.default());
|
||||
import("../daemons/janitor.js").then((x) => x.default());
|
||||
|
@ -1,5 +1,6 @@
|
||||
import cluster from "node:cluster";
|
||||
import { initDb } from "../db/postgre.js";
|
||||
import config from "@/config/index.js";
|
||||
|
||||
/**
|
||||
* Init worker process
|
||||
@ -7,8 +8,10 @@ import { initDb } from "../db/postgre.js";
|
||||
export async function workerMain() {
|
||||
await initDb();
|
||||
|
||||
// start server
|
||||
await import("../server/index.js").then((x) => x.default());
|
||||
if (!config.onlyQueueProcessor) {
|
||||
// start server
|
||||
await import("../server/index.js").then((x) => x.default());
|
||||
}
|
||||
|
||||
// start job queue
|
||||
import("../queue/index.js").then((x) => x.default());
|
||||
|
@ -52,6 +52,8 @@ export type Source = {
|
||||
|
||||
clusterLimit?: number;
|
||||
|
||||
onlyQueueProcessor?: boolean;
|
||||
|
||||
id: string;
|
||||
|
||||
outgoingAddressFamily?: "ipv4" | "ipv6" | "dual";
|
||||
|
Loading…
Reference in New Issue
Block a user