mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Better restart/shutdown refresh page polling
This commit is contained in:
parent
20e3eebd6a
commit
b76143116c
1 changed files with 24 additions and 27 deletions
|
@ -54,34 +54,31 @@
|
|||
window.location.href = "${new_http_root}index";
|
||||
}
|
||||
|
||||
// Redirect to home page if page is available.
|
||||
var checkOnline = setInterval(checkPageOffline, 1000);
|
||||
var online = true;
|
||||
|
||||
function checkPageOffline() {
|
||||
$.ajax({
|
||||
type: 'HEAD',
|
||||
url: 'index',
|
||||
timeout: 1000,
|
||||
error: function () {
|
||||
% if signal != 'shutdown':
|
||||
clearInterval(checkOnline);
|
||||
setInterval(checkPageOnline, 1000);
|
||||
% else:
|
||||
reloadPage();
|
||||
% endif
|
||||
}
|
||||
});
|
||||
}
|
||||
function checkPageOnline() {
|
||||
$.ajax({
|
||||
type: 'HEAD',
|
||||
url: 'index',
|
||||
timeout: 1000,
|
||||
success: function () {
|
||||
reloadPage();
|
||||
}
|
||||
});
|
||||
}
|
||||
(function poll() {
|
||||
setTimeout(function () {
|
||||
$.ajax({
|
||||
url: 'index',
|
||||
type: 'HEAD',
|
||||
success: function () {
|
||||
if (!(online)){
|
||||
reloadPage();
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
online = false;
|
||||
% if signal == 'shutdown':
|
||||
reloadPage();
|
||||
% endif
|
||||
},
|
||||
complete: function () {
|
||||
poll();
|
||||
},
|
||||
timeout: 1000
|
||||
});
|
||||
}, 1000);
|
||||
})();
|
||||
</script>
|
||||
|
||||
</%def>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue