Fix SIGTERM handler not disconnecting gateway clients and leaving timeouts active
This commit is contained in:
parent
1dcaa9f5f9
commit
ac7a178f88
@ -39,6 +39,9 @@ const gateway = new Gateway.Server({ server, port, production });
|
|||||||
|
|
||||||
process.on("SIGTERM", async () => {
|
process.on("SIGTERM", async () => {
|
||||||
console.log("Shutting down due to SIGTERM");
|
console.log("Shutting down due to SIGTERM");
|
||||||
|
await gateway.stop();
|
||||||
|
await cdn.stop();
|
||||||
|
await api.stop();
|
||||||
server.close();
|
server.close();
|
||||||
Sentry.close();
|
Sentry.close();
|
||||||
});
|
});
|
||||||
|
@ -82,7 +82,11 @@ export class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async stop() {
|
async stop() {
|
||||||
closeDatabase();
|
this.ws.clients.forEach((x) => x.close());
|
||||||
this.server.close();
|
this.ws.close(() => {
|
||||||
|
this.server.close(() => {
|
||||||
|
closeDatabase();
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user