perf(backend): createdAtをidから取得するように & 無駄なDateインスタンスの生成を避けるように

This commit is contained in:
syuilo 2023-10-16 10:45:22 +09:00
parent 15706c8c2b
commit 1fa1d31696
171 changed files with 442 additions and 537 deletions

View file

@ -47,13 +47,13 @@ export class AggregateRetentionProcessorService {
// 今日登録したユーザーを全て取得
const targetUsers = await this.usersRepository.findBy({
host: IsNull(),
createdAt: MoreThan(new Date(Date.now() - (1000 * 60 * 60 * 24))),
id: MoreThan(this.idService.gen(Date.now() - (1000 * 60 * 60 * 24))),
});
const targetUserIds = targetUsers.map(u => u.id);
try {
await this.retentionAggregationsRepository.insert({
id: this.idService.genId(),
id: this.idService.gen(),
createdAt: now,
updatedAt: now,
dateKey,