mirror of
https://github.com/janeczku/calibre-web
synced 2026-10-14 12:01:41 +00:00
Calibre-web reboot now waits for calibre-web to come back
This commit is contained in:
+24
-18
@@ -326,6 +326,20 @@ $(function() {
|
||||
$("#RestartDialog").modal("hide");
|
||||
}
|
||||
|
||||
function waitForAdminAlive(onAvailable) {
|
||||
var aliveInterval = setInterval(function () {
|
||||
$.get({
|
||||
url: getPath() + "/admin/alive",
|
||||
success: function (d, statusText, xhr) {
|
||||
if (xhr.status < 400) {
|
||||
clearInterval(aliveInterval);
|
||||
onAvailable();
|
||||
}
|
||||
},
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
clearInterval(updateTimerID);
|
||||
$("#spinner2").hide();
|
||||
@@ -456,7 +470,7 @@ $(function() {
|
||||
data: JSON.stringify({"parameter":0}),
|
||||
success: function success() {
|
||||
$("#spinner").show();
|
||||
setTimeout(restartTimer, 3000);
|
||||
waitForAdminAlive(restartTimer);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -781,26 +795,18 @@ $(function() {
|
||||
$("#flash_danger").remove();
|
||||
$.post(getPath() + request_path, $(this).closest("form").serialize(), function(data) {
|
||||
$('#config_upload_formats').val(data.config_upload);
|
||||
if(data.reboot) {
|
||||
if (data.reboot) {
|
||||
$("#spinning_success").show();
|
||||
var rebootInterval = setInterval(function(){
|
||||
$.get({
|
||||
url:getPath() + "/admin/alive",
|
||||
success: function (d, statusText, xhr) {
|
||||
if (xhr.status < 400) {
|
||||
$("#spinning_success").hide();
|
||||
clearInterval(rebootInterval);
|
||||
if (data.result) {
|
||||
handle_response(data.result);
|
||||
data.result = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}, 1000);
|
||||
waitForAdminAlive(function () {
|
||||
$("#spinning_success").hide();
|
||||
if (data.result) {
|
||||
handle_response(data.result);
|
||||
data.result = "";
|
||||
}
|
||||
});
|
||||
} else {
|
||||
handle_response(data.result);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user