mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 22:47:18 +03:00
Fixing stacking timeout issue
This commit is contained in:
@@ -55,6 +55,7 @@ let sponsorVideoID: VideoID = null;
|
|||||||
// List of open skip notices
|
// List of open skip notices
|
||||||
const skipNotices: SkipNotice[] = [];
|
const skipNotices: SkipNotice[] = [];
|
||||||
let activeSkipKeybindElement: ToggleSkippable = null;
|
let activeSkipKeybindElement: ToggleSkippable = null;
|
||||||
|
let retryFetchTimeout: NodeJS.Timeout = null;
|
||||||
|
|
||||||
// JSON video info
|
// JSON video info
|
||||||
let videoInfo: VideoInfo = null;
|
let videoInfo: VideoInfo = null;
|
||||||
@@ -1137,15 +1138,16 @@ function retryFetch(errorCode: number): void {
|
|||||||
if (!Config.config.refetchWhenNotFound) return;
|
if (!Config.config.refetchWhenNotFound) return;
|
||||||
sponsorDataFound = false;
|
sponsorDataFound = false;
|
||||||
|
|
||||||
if (errorCode !== 404 && retryCount > 1) {
|
if (retryFetchTimeout) clearTimeout(retryFetchTimeout);
|
||||||
|
if ((errorCode !== 404 && retryCount > 1) || (errorCode !== 404 && retryCount > 10)) {
|
||||||
// Too many errors (50x), give up
|
// Too many errors (50x), give up
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
retryCount++;
|
retryCount++;
|
||||||
|
|
||||||
const delay = errorCode === 404 ? (10000 + Math.random() * 30000) : (2000 + Math.random() * 10000);
|
const delay = errorCode === 404 ? (30000 + Math.random() * 30000) : (2000 + Math.random() * 10000);
|
||||||
setTimeout(() => {
|
retryFetchTimeout = setTimeout(() => {
|
||||||
if (sponsorVideoID && sponsorTimes?.length === 0
|
if (sponsorVideoID && sponsorTimes?.length === 0
|
||||||
|| sponsorTimes.every((segment) => segment.source !== SponsorSourceType.Server)) {
|
|| sponsorTimes.every((segment) => segment.source !== SponsorSourceType.Server)) {
|
||||||
sponsorsLookup();
|
sponsorsLookup();
|
||||||
|
|||||||
Reference in New Issue
Block a user