From 10cc5cd3618bcedb58204ef67faa4ab3dc1376de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=AC=B4=EB=9D=BC=EC=BF=A0=EB=AA=A8?= Date: Fri, 4 Oct 2024 23:01:47 +0900 Subject: [PATCH] fix(ReindexNotesProcessor): total only needs to be get once --- .../src/queue/processors/ReindexNotesProcessorService.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/queue/processors/ReindexNotesProcessorService.ts b/packages/backend/src/queue/processors/ReindexNotesProcessorService.ts index a5c8c8e33..a46d2cd73 100644 --- a/packages/backend/src/queue/processors/ReindexNotesProcessorService.ts +++ b/packages/backend/src/queue/processors/ReindexNotesProcessorService.ts @@ -40,6 +40,9 @@ export class ReindexNotesProcessorService { order: { id: 'DESC' }, take: 1, }))[0]; + const total = await this.notesRepository.countBy({ + id: LessThanOrEqual(lastNote.id), + }); let indexedCount = 0; let cursor: MiNote['id'] | null = null; @@ -66,10 +69,6 @@ export class ReindexNotesProcessorService { indexedCount += 20; - const total = await this.notesRepository.countBy({ - id: LessThanOrEqual(lastNote.id), - }); - await job.updateProgress(100 / total * indexedCount); }