From c120261e2b8fbc2d79f4268627bf5f79aabf8d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 18 Dec 2015 17:29:31 +0100 Subject: [PATCH] Increased backend fail counter for intermediary page Also made sure that baseURL always ends in a / --- src/octoprint/static/intermediary.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/octoprint/static/intermediary.html b/src/octoprint/static/intermediary.html index b315210a..4aa7276a 100644 --- a/src/octoprint/static/intermediary.html +++ b/src/octoprint/static/intermediary.html @@ -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); }