/_info_card_ のユーザー数・ノート数のクエリをキャッシュする (#514)

This commit is contained in:
riku6460 2024-03-07 23:44:41 +09:00 committed by GitHub
parent 9728608015
commit c6376a395e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 2 deletions

View File

@ -776,12 +776,17 @@ export class ClientServerService {
reply.removeHeader('X-Frame-Options'); reply.removeHeader('X-Frame-Options');
const [originalUsersCount, originalNotesCount] = await Promise.all([
this.usersRepository.count({ where: { host: IsNull() }, cache: 1000 * 60 * 60 * 6 }), // 6 hours
this.notesRepository.count({ where: { userHost: IsNull() }, cache: 1000 * 60 * 60 * 6 }), // 6 hours
]);
return await reply.view('info-card', { return await reply.view('info-card', {
version: this.config.version, version: this.config.version,
host: this.config.host, host: this.config.host,
meta: meta, meta: meta,
originalUsersCount: await this.usersRepository.countBy({ host: IsNull() }), originalUsersCount,
originalNotesCount: await this.notesRepository.countBy({ userHost: IsNull() }), originalNotesCount,
}); });
}); });