Improved speed of whitelist check.

This commit is contained in:
Ajay Ramachandran
2019-11-23 17:53:04 -05:00
parent 2fa412e574
commit 0a84dbd3a5

View File

@@ -378,6 +378,18 @@ function sponsorsLookup(id, channelIDPromise) {
v.addEventListener('durationchange', updatePreviewBar);
}
if (channelIDPromise != null) {
if (channelIDPromise.isFulfilled) {
whitelistCheck();
} else if (channelIDPromise.isRejected) {
//try again
wait(getChannelID).then(whitelistCheck).catch();
} else {
//add it as a then statement
channelIDPromise.then(whitelistCheck);
}
}
//check database for sponsor times
//made true once a setTimeout has been created to try again after a server error
let recheckStarted = false;
@@ -396,18 +408,6 @@ function sponsorsLookup(id, channelIDPromise) {
updatePreviewBar();
}
if (channelIDPromise != null) {
if (channelIDPromise.isFulfilled) {
whitelistCheck();
} else if (channelIDPromise.isRejected) {
//try again
wait(getChannelID).then(whitelistCheck).catch();
} else {
//add it as a then statement
channelIDPromise.then(whitelistCheck);
}
}
sponsorLookupRetries = 0;
} else if (xmlhttp.readyState == 4 && xmlhttp.status == 404) {
sponsorDataFound = false;