Back out "auto start server"
Summary: Original commit changeset: 2c11e80429a2 Original Phabricator Diff: D50074673 lblasa got reports it doesn't always work (possibly permission issues) Reviewed By: lblasa Differential Revision: D50259755 fbshipit-source-id: 1cd5f92c4e6e40a06340ecfebea01b899ac1cc85
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6468665116
commit
8f056646d9
@@ -137,6 +137,7 @@
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
button.value = 'Start';
|
button.value = 'Start';
|
||||||
|
|
||||||
}, 30 * 10000);
|
}, 30 * 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,24 +148,18 @@
|
|||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
let autoStarted = false;
|
|
||||||
|
|
||||||
// Check if the server is responding & reload the page if it is.
|
// Check if the server is responding & reload the page if it is.
|
||||||
// This handles the case when the device is online, but the server
|
// This handles the case when the device is online, but the server
|
||||||
// is offline or misbehaving.
|
// is offline or misbehaving.
|
||||||
async function checkNetworkAndReload() {
|
async function checkNetworkAndReload() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('.');
|
const response = await fetch('.');
|
||||||
if (response.status === 200) {
|
if (response.status >= 200 && response.status < 500) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// trigger submit button automatically, but only once
|
// Unable to connect to the server, ignore.
|
||||||
if (!autoStarted) {
|
|
||||||
autoStarted = true;
|
|
||||||
document.getElementById("submit").click();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
window.setTimeout(checkNetworkAndReload, 2500);
|
window.setTimeout(checkNetworkAndReload, 2500);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user