generated from technologiestiftung/template-repo-citylab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add delay to start and add env to ecosystem.config.cjs
Signed-off-by: Raphael Arce <[email protected]>
- Loading branch information
1 parent
79c5777
commit 717399d
Showing
2 changed files
with
22 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
import bluetoothSerialMonitors from "./services/bluetooth/bluetooth.js"; | ||
import server from "./services/rest/rest.js"; | ||
import { webSocketServer } from "./services/socket/socket.js"; | ||
import { gpioProcess } from "./services/gpio/gpio.js"; | ||
import "./services/print/print.js"; | ||
import "./services/browser/browser.js"; | ||
setTimeout(async () => { | ||
const bluetoothSerialMonitors = import("./services/bluetooth/bluetooth.js"); | ||
const server = import("./services/rest/rest.js"); | ||
const { webSocketServer } = import("./services/socket/socket.js"); | ||
const { gpioProcess } = import("./services/gpio/gpio.js"); | ||
await import("./services/print/print.js"); | ||
await import("./services/browser/browser.js"); | ||
|
||
process.on("SIGINT", () => closeEverything(1)); | ||
process.on("SIGINT", () => closeEverything(1)); | ||
|
||
process.on("SIGTERM", () => closeEverything(0)); | ||
process.on("SIGTERM", () => closeEverything(0)); | ||
|
||
function closeEverything(eventId) { | ||
bluetoothSerialMonitors.forEach((monitor) => monitor.kill()); | ||
server.close(); | ||
webSocketServer.clients.forEach((client) => client.close()); | ||
webSocketServer.close(); | ||
gpioProcess.kill(); | ||
function closeEverything(eventId) { | ||
bluetoothSerialMonitors.forEach((monitor) => monitor.kill()); | ||
server.close(); | ||
webSocketServer.clients.forEach((client) => client.close()); | ||
webSocketServer.close(); | ||
gpioProcess.kill(); | ||
|
||
process.exit(eventId) | ||
} | ||
process.exit(eventId); | ||
} | ||
}, 30_000); |