mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-08 05:43:04 +00:00
Add probe caching and dedupe for playback
This commit is contained in:
1 parent
b246e8a37b
commit
2007e53b39
2 files changed
+97
-3
No files matched your search
@@ -280,6 +280,7 @@ class Application {
|
||||
this.torrentStatusNodes = null;
|
||||
this.torrentStatusVisibilityHandler = null;
|
||||
this.torrentStatusPageHideHandler = null;
|
||||
this.urlProbePromises = new Map();
|
||||
|
||||
this.commentController = null;
|
||||
this.initializeCommentController();
|
||||
@@ -8200,7 +8201,23 @@ class Application {
|
||||
}
|
||||
|
||||
async probeUrl(url, options = {}) {
|
||||
return this.urlHealthController.probeUrl(url, options);
|
||||
const trimmed = typeof url === "string" ? url.trim() : "";
|
||||
if (!trimmed) {
|
||||
return this.urlHealthController.probeUrl(url, options);
|
||||
}
|
||||
const existing = this.urlProbePromises.get(trimmed);
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
const probePromise = (async () => {
|
||||
try {
|
||||
return await this.urlHealthController.probeUrl(trimmed, options);
|
||||
} finally {
|
||||
this.urlProbePromises.delete(trimmed);
|
||||
}
|
||||
})();
|
||||
this.urlProbePromises.set(trimmed, probePromise);
|
||||
return probePromise;
|
||||
}
|
||||
|
||||
async playHttp(videoEl, url) {
|
||||
|
||||
Reference in new issue
Block a user