Fix: Attempt to Improve UI-Login Cache (#63)

This commit is contained in:
Youwes09
2026-05-03 12:29:20 -05:00
parent 093b395cc1
commit 0d53e3f102
8 changed files with 58 additions and 42 deletions
+7 -2
View File
@@ -56,7 +56,7 @@ function drain() {
active++;
doFetch(entry.url)
.then(entry.resolve, entry.reject)
.finally(() => { inflight.delete(entry.url); active--; drain(); });
.finally(() => { active--; drain(); });
}
}
@@ -67,7 +67,12 @@ function scheduleDrain() {
}
function enqueue(url: string, priority: number): Promise<string> {
const promise = new Promise<string>((resolve, reject) => { insertSorted({ url, priority, resolve, reject }); });
const promise = new Promise<string>((resolve, reject) => {
insertSorted({ url, priority, resolve, reject });
}).catch(err => {
inflight.delete(url);
return Promise.reject(err);
});
inflight.set(url, promise);
scheduleDrain();
return promise;