mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-17 12:35:37 +02:00
* perf: rsa sign on slacc * fix: missing async/await * fix: threadPoolSize is always number Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * test(backend): init slacc in unit setup and await ap-request signing * test(backend): move slacc init to unit testEnvironment * test(backend): delete unused file * docs: update CHANGELOG * docs: fix indent Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * chore: migrate to vitest * fix * fix: fix changelog * chore: regenerate lockfile * docs: changelog --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { NestFactory } from '@nestjs/core';
|
|
import { init } from 'slacc';
|
|
import { NestLogger } from '@/NestLogger.js';
|
|
import type { Config } from '@/config.js';
|
|
|
|
let slaccInitialized = false;
|
|
|
|
export function initExtraThreadPool(config: Config) {
|
|
if (slaccInitialized) return;
|
|
|
|
const threadPoolSize = Math.max(config.threadPoolSize ?? 1, 1);
|
|
|
|
init(threadPoolSize);
|
|
|
|
slaccInitialized = true;
|
|
}
|
|
|
|
export async function server() {
|
|
const { MainModule } = await import('../MainModule.js');
|
|
const { ServerService } = await import('../server/ServerService.js');
|
|
|
|
const app = await NestFactory.createApplicationContext(MainModule, {
|
|
logger: new NestLogger(),
|
|
});
|
|
|
|
const serverService = app.get(ServerService);
|
|
await serverService.launch();
|
|
|
|
if (process.env.NODE_ENV !== 'test') {
|
|
const { ChartManagementService } = await import('../core/chart/ChartManagementService.js');
|
|
const { QueueStatsService } = await import('../daemons/QueueStatsService.js');
|
|
const { ServerStatsService } = await import('../daemons/ServerStatsService.js');
|
|
|
|
app.get(ChartManagementService).start();
|
|
app.get(QueueStatsService).start();
|
|
app.get(ServerStatsService).start();
|
|
}
|
|
|
|
return app;
|
|
}
|
|
|
|
export async function jobQueue() {
|
|
const { QueueProcessorModule } = await import('../queue/QueueProcessorModule.js');
|
|
const { QueueProcessorService } = await import('../queue/QueueProcessorService.js');
|
|
const { ChartManagementService } = await import('../core/chart/ChartManagementService.js');
|
|
|
|
const jobQueue = await NestFactory.createApplicationContext(QueueProcessorModule, {
|
|
logger: new NestLogger(),
|
|
});
|
|
|
|
jobQueue.get(QueueProcessorService).start();
|
|
jobQueue.get(ChartManagementService).start();
|
|
|
|
return jobQueue;
|
|
}
|