mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-25 19:52:36 +01:00
Fix SIGTERM handler not disconnecting gateway clients and leaving timeouts active
This commit is contained in:
parent
b82c6d672b
commit
45793e82fd
@ -39,6 +39,9 @@ const gateway = new Gateway.Server({ server, port, production });
|
||||
|
||||
process.on("SIGTERM", async () => {
|
||||
console.log("Shutting down due to SIGTERM");
|
||||
await gateway.stop();
|
||||
await cdn.stop();
|
||||
await api.stop();
|
||||
server.close();
|
||||
Sentry.close();
|
||||
});
|
||||
|
@ -82,7 +82,11 @@ export class Server {
|
||||
}
|
||||
|
||||
async stop() {
|
||||
this.ws.clients.forEach((x) => x.close());
|
||||
this.ws.close(() => {
|
||||
this.server.close(() => {
|
||||
closeDatabase();
|
||||
this.server.close();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user