Terminate bridge process after handling SIGTERM

This commit is contained in:
hensm
2022-08-27 09:20:08 +01:00
parent a65b3bbe4a
commit 0753c701a0
2 changed files with 6 additions and 4 deletions

View File

@@ -185,9 +185,9 @@ export function stopMediaServer() {
mediaServer.close(err => {
if (err) {
reject();
} else {
resolve();
}
resolve();
});
mediaServer = undefined;

View File

@@ -10,9 +10,11 @@ import { startMediaServer, stopMediaServer } from "./components/mediaServer";
import { applicationVersion } from "../../config.json";
process.on("SIGTERM", () => {
process.on("SIGTERM", async () => {
discovery?.stop();
stopMediaServer();
await stopMediaServer();
process.exit(1);
});
let discovery: Discovery | null = null;