fix: Improve graceful shutdown

This commit is contained in:
Tom Moor
2021-10-04 18:20:42 -07:00
parent 28097835d0
commit df5dc2f691
5 changed files with 21 additions and 6 deletions

View File

@@ -36,4 +36,8 @@ export default function init(app: Koa, server: http.Server) {
app.use(websocket());
app.use(router.routes());
app.use(router.allowedMethods());
server.on("shutdown", () => {
hocuspocus.destroy();
});
}

View File

@@ -23,6 +23,10 @@ export default function init(app: Koa, server: http.Server) {
cookie: false,
});
server.on("shutdown", () => {
Metrics.gaugePerInstance("websockets.count", 0);
});
io.adapter(
socketRedisAdapter({
pubClient: client,