mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Fix FSRS progress update issues (#3420)
* Delay optimal FSRS params alert to ensure progress updates are reported * Ensure progress updates arrive synchronously
This commit is contained in:
parent
cb3a7579de
commit
847f3f6714
2 changed files with 10 additions and 4 deletions
|
@ -8,13 +8,19 @@ export async function runWithBackendProgress<T>(
|
|||
callback: () => Promise<T>,
|
||||
onUpdate: (progress: Progress) => void,
|
||||
): Promise<T> {
|
||||
const intervalId = setInterval(async () => {
|
||||
let done = false;
|
||||
async function progressCallback() {
|
||||
const progress = await latestProgress({});
|
||||
onUpdate(progress);
|
||||
}, 100);
|
||||
if (done) {
|
||||
return;
|
||||
}
|
||||
setTimeout(progressCallback, 100);
|
||||
}
|
||||
setTimeout(progressCallback, 100);
|
||||
try {
|
||||
return await callback();
|
||||
} finally {
|
||||
clearInterval(intervalId);
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
)) ||
|
||||
resp.weights.length === 0
|
||||
) {
|
||||
alert(tr.deckConfigFsrsParamsOptimal());
|
||||
setTimeout(() => alert(tr.deckConfigFsrsParamsOptimal()), 100);
|
||||
}
|
||||
if (computeWeightsProgress) {
|
||||
computeWeightsProgress.current = computeWeightsProgress.total;
|
||||
|
|
Loading…
Reference in a new issue