fix(ReindexNotesProcessor): total only needs to be get once
All checks were successful
Publish Docker Image (Misskey) TeamCity build finished

This commit is contained in:
オスカー、 2024-10-04 23:01:47 +09:00
parent 8af17dc0cd
commit 10cc5cd361
Signed by: SWREI
GPG Key ID: 139D6573F92DA9F7

View File

@ -40,6 +40,9 @@ export class ReindexNotesProcessorService {
order: { id: 'DESC' }, order: { id: 'DESC' },
take: 1, take: 1,
}))[0]; }))[0];
const total = await this.notesRepository.countBy({
id: LessThanOrEqual(lastNote.id),
});
let indexedCount = 0; let indexedCount = 0;
let cursor: MiNote['id'] | null = null; let cursor: MiNote['id'] | null = null;
@ -66,10 +69,6 @@ export class ReindexNotesProcessorService {
indexedCount += 20; indexedCount += 20;
const total = await this.notesRepository.countBy({
id: LessThanOrEqual(lastNote.id),
});
await job.updateProgress(100 / total * indexedCount); await job.updateProgress(100 / total * indexedCount);
} }