This commit is contained in:
Rizky 2024-08-15 21:32:24 +07:00
parent 13c691a286
commit 69d2a57d07
2 changed files with 6 additions and 3 deletions

View File

@ -44,6 +44,9 @@ const startMain = () => {
const worker = new Worker("pkgs/index.ts");
worker.onmessage = (event) => {
if (event.data === "terminate") {
worker.terminate();
}
if (event.data === "restart") {
main.old = main.process;
setTimeout(() => {

View File

@ -34,8 +34,8 @@ export const createServer = async () => {
} catch (e) {
g.log.warn(
`Failed to import app/srv/api${importPath.substring(
(root || path).length,
)}`,
(root || path).length
)}`
);
const f = file(importPath);
@ -67,7 +67,7 @@ export const createServer = async () => {
addEventListener("message", (e) => {
if (e.data === "stop-server") {
g.server.stop();
process.exit();
postMessage("terminate");
}
});
}