From 42fa6c44c4c885543812da9d79406df38ce23e68 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 31 May 2021 14:37:12 -0400 Subject: [PATCH] Prevent retry fetching in another place https://github.com/ajayyy/SponsorBlock/issues/667 --- src/content.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/content.ts b/src/content.ts index 5f43ae75..8154e99e 100644 --- a/src/content.ts +++ b/src/content.ts @@ -621,7 +621,11 @@ async function sponsorsLookup(id: string) { //TODO lower when server becomes better (back to 1 second) //some error occurred, try again in a second - setTimeout(() => sponsorsLookup(id), 5000 + Math.random() * 15000 + 5000 * sponsorLookupRetries); + setTimeout(() => { + if (sponsorVideoID && sponsorTimes?.length === 0) { + sponsorsLookup(sponsorVideoID); + } + }, 5000 + Math.random() * 15000 + 5000 * sponsorLookupRetries); sponsorLookupRetries++; }