Update src/libpoketube/libpoketube-core.js

This commit is contained in:
ashley 2025-09-23 22:17:13 +02:00
parent 2977b1dcf8
commit c43e7120ec

View File

@ -59,9 +59,9 @@ class InnerTubePokeVidious {
"User-Agent": this.useragent, "User-Agent": this.useragent,
}; };
// Retries only within a 5s window that starts AFTER the first 500/502. // Retries only within a 8s window that starts AFTER the first 500/502.
// Fast path: one plain fetch with no extra timers/signals unless 500/502 occurs. // Fast path: one plain fetch with no extra timers/signals unless 500/502 occurs.
const fetchWithRetry = async (url, options = {}, maxRetryTime = 5000) => { const fetchWithRetry = async (url, options = {}, maxRetryTime = 8000) => {
let lastError; let lastError;
// Trigger statuses that arm the retry window // Trigger statuses that arm the retry window
@ -157,7 +157,7 @@ const fetchWithRetry = async (url, options = {}, maxRetryTime = 5000) => {
// Optional short stagger before the first retry to reduce herd effects // Optional short stagger before the first retry to reduce herd effects
// await sleep(50 + ((Math.random() * 150) | 0)); // await sleep(50 + ((Math.random() * 150) | 0));
// Retry loop within the 5s window // Retry loop within the 8s window
while (true) { while (true) {
const elapsed = Date.now() - retryStart; const elapsed = Date.now() - retryStart;
const remaining = maxRetryTime - elapsed; const remaining = maxRetryTime - elapsed;