aboutsummaryrefslogtreecommitdiffhomepage
path: root/content.js
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2019-08-22 22:43:55 -0400
committerAjay Ramachandran <[email protected]>2019-08-22 22:43:55 -0400
commit98eb72ef1f4aab9f4f9b74f2eb2e057fd32613db (patch)
tree0f228b3e24c60f541ed387d577d0e15a3dba8158 /content.js
parent89d127c5c5f58caabddbe00727f4e2d4b8ba3e15 (diff)
downloadSponsorBlock-98eb72ef1f4aab9f4f9b74f2eb2e057fd32613db.tar.gz
SponsorBlock-98eb72ef1f4aab9f4f9b74f2eb2e057fd32613db.zip
Made sure rechecks didn't happen twice.
Diffstat (limited to 'content.js')
-rw-r--r--content.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/content.js b/content.js
index 28846568..303b4d41 100644
--- a/content.js
+++ b/content.js
@@ -329,6 +329,9 @@ function sponsorsLookup(id) {
}
//check database for sponsor times
+
+ //made true once a setTimeout has been created to try again after a server error
+ let recheckStarted = false;
sendRequestToServer('GET', "/api/getVideoSponsorTimes?videoID=" + id, function(xmlhttp) {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
sponsorDataFound = true;
@@ -364,7 +367,9 @@ function sponsorsLookup(id) {
});
sponsorLookupRetries = 0;
- } else if (xmlhttp.readyState == 4 && sponsorLookupRetries < 90) {
+ } else if (xmlhttp.readyState == 4 && sponsorLookupRetries < 90 && !recheckStarted) {
+ recheckStarted = true;
+
//some error occurred, try again in a second
setTimeout(() => sponsorsLookup(id), 1000);