mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-12 11:30:01 -04:00
Resolve run-command.mjs waiting periods
This commit is contained in:
parent
6412190943
commit
192495d44a
1 changed files with 3 additions and 1 deletions
|
@ -54,14 +54,16 @@ for(let i = 2; i < process.argv.length; i++)
|
|||
case "stop":
|
||||
await writeFile(shutdown, "");
|
||||
try {
|
||||
let timeoutId = undefined;
|
||||
const response = await Promise.race([
|
||||
fetch(new URL("/test-shutdown", serverUrl)),
|
||||
new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
timeoutId = setTimeout(() => {
|
||||
resolve("Error");
|
||||
}, 5000);
|
||||
})
|
||||
]);
|
||||
clearTimeout(timeoutId);
|
||||
if(response === "Error") throw new Error("Server is unresponsive.");
|
||||
} catch (e) {await unlink(shutdown)}
|
||||
if (config.production)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue