fix(ReindexNotesProcessor): total only needs to be get once
This commit is contained in:
parent
8af17dc0cd
commit
10cc5cd361
1 changed files with 3 additions and 4 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue