mirror of
https://github.com/spacebarchat/server.git
synced 2026-06-08 15:11:54 +00:00
Process lifecycle scripts
#Conflicts: # src/api/Server.ts # src/bundle/Server.ts # src/cdn/Server.ts # src/gateway/Server.ts # src/gateway/events/Connection.ts # src/util/util/ipc/listener/RabbitMqSingleListener.ts # src/util/util/ipc/listener/UnixSocketListener.ts # src/util/util/ipc/writer/UnixSocketWriter.ts # src/webrtc/Server.ts
This commit is contained in:
+7
-11
@@ -16,21 +16,18 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import morgan from "morgan";
|
||||
|
||||
process.on("unhandledRejection", console.error);
|
||||
process.on("uncaughtException", console.error);
|
||||
|
||||
import http from "node:http";
|
||||
import fs from "node:fs";
|
||||
import cluster from "node:cluster";
|
||||
import morgan from "morgan";
|
||||
import express from "express";
|
||||
import { green, bold } from "picocolors";
|
||||
import * as Api from "@spacebar/api";
|
||||
import * as Gateway from "@spacebar/gateway";
|
||||
import * as Webrtc from "@spacebar/webrtc";
|
||||
import { CDNServer } from "@spacebar/cdn";
|
||||
import express from "express";
|
||||
import { green, bold } from "picocolors";
|
||||
import { Config, initDatabase } from "@spacebar/util";
|
||||
import fs from "node:fs";
|
||||
import cluster from "node:cluster";
|
||||
import { ProcessLifecycle } from "../util/util/ProcessLifecycle";
|
||||
|
||||
const app = express();
|
||||
const server = http.createServer();
|
||||
@@ -48,8 +45,7 @@ const webrtc = new Webrtc.Server({
|
||||
production,
|
||||
});
|
||||
|
||||
process.on("SIGTERM", async () => {
|
||||
console.log("Shutting down due to SIGTERM");
|
||||
ProcessLifecycle.eventEmitter.on("stopping", async () => {
|
||||
await gateway.stop();
|
||||
await cdn.stop();
|
||||
await api.stop();
|
||||
|
||||
Reference in New Issue
Block a user