perf(backend): lazy load summaly

This commit is contained in:
syuilo 2025-11-30 16:17:34 +09:00
parent 0933aa4d92
commit dfd479bec5
1 changed files with 4 additions and 3 deletions

View File

@ -4,8 +4,7 @@
*/ */
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import { summaly } from '@misskey-dev/summaly'; import type { SummalyResult } from '@misskey-dev/summaly/built/summary.js';
import { SummalyResult } from '@misskey-dev/summaly/built/summary.js';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
import { HttpRequestService } from '@/core/HttpRequestService.js'; import { HttpRequestService } from '@/core/HttpRequestService.js';
@ -113,7 +112,7 @@ export class UrlPreviewService {
} }
} }
private fetchSummary(url: string, meta: MiMeta, lang?: string): Promise<SummalyResult> { private async fetchSummary(url: string, meta: MiMeta, lang?: string): Promise<SummalyResult> {
const agent = this.config.proxy const agent = this.config.proxy
? { ? {
http: this.httpRequestService.httpAgent, http: this.httpRequestService.httpAgent,
@ -121,6 +120,8 @@ export class UrlPreviewService {
} }
: undefined; : undefined;
const { summaly } = await import('@misskey-dev/summaly');
return summaly(url, { return summaly(url, {
followRedirects: this.meta.urlPreviewAllowRedirect, followRedirects: this.meta.urlPreviewAllowRedirect,
lang: lang ?? 'ja-JP', lang: lang ?? 'ja-JP',