fix(ReindexNotesProcessor): total only needs to be get once

This commit is contained in:
무라쿠모 2024-10-04 23:01:47 +09:00
parent 8af17dc0cd
commit 10cc5cd361
No known key found for this signature in database
GPG key ID: 139D6573F92DA9F7

View file

@ -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);
}