summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2019-08-27 05:33:24 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-08-27 05:33:24 +0900
commit6a0affcec10088ff60ab725f2564e7df7f0eaf17 (patch)
tree6a0bf03478a01702d94dbf420c9a182587471630 /src
parent未実装のTLのRenoteクエリを実装 (#5343) (diff)
downloadmisskey-6a0affcec10088ff60ab725f2564e7df7f0eaf17.tar.gz
misskey-6a0affcec10088ff60ab725f2564e7df7f0eaf17.tar.bz2
misskey-6a0affcec10088ff60ab725f2564e7df7f0eaf17.zip
Tune worker/job counts (#5346)
* デフォルトのワーカー数を1に * Tune default job count
Diffstat (limited to 'src')
-rw-r--r--src/boot/master.ts2
-rw-r--r--src/config/types.ts3
-rw-r--r--src/queue/index.ts4
3 files changed, 6 insertions, 3 deletions
diff --git a/src/boot/master.ts b/src/boot/master.ts
index b698548d47..381c4bc4ca 100644
--- a/src/boot/master.ts
+++ b/src/boot/master.ts
@@ -159,7 +159,7 @@ async function init(): Promise<Config> {
return config;
}
-async function spawnWorkers(limit: number = Infinity) {
+async function spawnWorkers(limit: number = 1) {
const workers = Math.min(limit, os.cpus().length);
bootLogger.info(`Starting ${workers} worker${workers === 1 ? '' : 's'}...`);
await Promise.all([...Array(workers)].map(spawnWorker));
diff --git a/src/config/types.ts b/src/config/types.ts
index 9ecf495c42..18382d7435 100644
--- a/src/config/types.ts
+++ b/src/config/types.ts
@@ -42,6 +42,9 @@ export type Source = {
id: string;
outgoingAddressFamily?: 'ipv4' | 'ipv6' | 'dual';
+
+ deliverJobConcurrency?: number;
+ inboxJobConcurrency?: number;
};
/**
diff --git a/src/queue/index.ts b/src/queue/index.ts
index a7e9b9814f..0b20017291 100644
--- a/src/queue/index.ts
+++ b/src/queue/index.ts
@@ -203,8 +203,8 @@ export function createCleanRemoteFilesJob() {
export default function() {
if (!program.onlyServer) {
- deliverQueue.process(128, processDeliver);
- inboxQueue.process(128, processInbox);
+ deliverQueue.process(config.deliverJobConcurrency || 128, processDeliver);
+ inboxQueue.process(config.inboxJobConcurrency || 16, processInbox);
processDb(dbQueue);
procesObjectStorage(objectStorageQueue);
}