Increased backend fail counter for intermediary page
Also made sure that baseURL always ends in a /
This commit is contained in:
parent
f0acacec6a
commit
c120261e2b
1 changed files with 8 additions and 3 deletions
|
|
@ -109,6 +109,8 @@
|
|||
urlToUse += "?" + postfix;
|
||||
}
|
||||
|
||||
console.log("Pinging " + url);
|
||||
|
||||
img.onload = function() {
|
||||
callback("load");
|
||||
calledBack = true;
|
||||
|
|
@ -119,6 +121,7 @@
|
|||
calledBack = true;
|
||||
}
|
||||
};
|
||||
|
||||
img.src = urlToUse;
|
||||
setTimeout(function() {
|
||||
if (!calledBack) {
|
||||
|
|
@ -137,7 +140,10 @@
|
|||
baseUrl = baseUrl.substring(0, baseUrl.indexOf("#"));
|
||||
}
|
||||
if (baseUrl.indexOf("/static") > -1) {
|
||||
baseUrl = baseUrl.substring(0, baseUrl.indexOf("/static")) + "/";
|
||||
baseUrl = baseUrl.substring(0, baseUrl.indexOf("/static"));
|
||||
}
|
||||
if (baseUrl[baseUrl.length - 1] != "/") {
|
||||
baseUrl += "/";
|
||||
}
|
||||
var serverOnlineUrl = baseUrl + "online.gif";
|
||||
var backendOnlineUrl = baseUrl + "intermediary.gif";
|
||||
|
|
@ -161,7 +167,6 @@
|
|||
interval = intervals.shift();
|
||||
}
|
||||
serverTimeout = setTimeout(function() {
|
||||
console.log("Pinging " + serverOnlineUrl);
|
||||
ping(serverOnlineUrl, timeout, serverOnlineCallback);
|
||||
}, interval * 1000)
|
||||
}
|
||||
|
|
@ -181,7 +186,7 @@
|
|||
}
|
||||
|
||||
backendOfflineCounter++;
|
||||
if (backendOfflineCounter > 5) {
|
||||
if (backendOfflineCounter > 10) {
|
||||
if (serverTimeout) {
|
||||
window.clearTimeout(serverTimeout);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue