forked from mirrors/misskey
ジョブキューのProgressの値を正しく計算する (#16218)
* fix: ジョブキューのProgressの値の範囲を 0~100 に統一 * fix(backend): ジョブキューのProgressの計算に用いる総数を最初に一度だけ取得する
This commit is contained in:
@@ -37,6 +37,8 @@ class NoteStream extends ReadableStream<Record<string, unknown>> {
|
||||
let exportedNotesCount = 0;
|
||||
let cursor: MiNote['id'] | null = null;
|
||||
|
||||
const totalPromise = notesRepository.countBy({ userId });
|
||||
|
||||
const serialize = (
|
||||
note: MiNote,
|
||||
poll: MiPoll | null,
|
||||
@@ -88,8 +90,8 @@ class NoteStream extends ReadableStream<Record<string, unknown>> {
|
||||
exportedNotesCount++;
|
||||
}
|
||||
|
||||
const total = await notesRepository.countBy({ userId });
|
||||
job.updateProgress(exportedNotesCount / total);
|
||||
const total = await totalPromise;
|
||||
job.updateProgress(exportedNotesCount / total * 100);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user