mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 14:37:23 +03:00
Fix race condition causing double fetch
This commit is contained in:
@@ -154,6 +154,7 @@ let isAdPlaying = false;
|
||||
|
||||
let lastResponseStatus: number;
|
||||
let retryCount = 0;
|
||||
let lookupWaiting = false;
|
||||
|
||||
// Contains all of the functions and variables needed by the skip notice
|
||||
const skipNoticeContentContainer: ContentContainer = () => ({
|
||||
@@ -965,10 +966,15 @@ function setupCategoryPill() {
|
||||
}
|
||||
|
||||
async function sponsorsLookup(keepOldSubmissions = true) {
|
||||
if (lookupWaiting) return;
|
||||
if (!video || !isVisible(video)) refreshVideoAttachments();
|
||||
//there is still no video here
|
||||
if (!video) {
|
||||
setTimeout(() => sponsorsLookup(), 100);
|
||||
lookupWaiting = true;
|
||||
setTimeout(() => {
|
||||
lookupWaiting = false;
|
||||
sponsorsLookup()
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user