chore: Improve graceful server shutdown (#4625)
* chore: Improve graceful server shutdown * Replace node timers with custom promise timeout
This commit is contained in:
@@ -6,6 +6,7 @@ import Koa from "koa";
|
||||
import WebSocket from "ws";
|
||||
import { DocumentValidation } from "@shared/validations";
|
||||
import Logger from "@server/logging/Logger";
|
||||
import ShutdownHelper, { ShutdownOrder } from "@server/utils/ShutdownHelper";
|
||||
import AuthenticationExtension from "../collaboration/AuthenticationExtension";
|
||||
import LoggerExtension from "../collaboration/LoggerExtension";
|
||||
import MetricsExtension from "../collaboration/MetricsExtension";
|
||||
@@ -79,7 +80,7 @@ export default function init(
|
||||
socket.end(`HTTP/1.1 400 Bad Request\r\n`);
|
||||
});
|
||||
|
||||
server.on("shutdown", () => {
|
||||
return hocuspocus.destroy();
|
||||
});
|
||||
ShutdownHelper.add("collaboration", ShutdownOrder.normal, () =>
|
||||
hocuspocus.destroy()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user