mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-15 15:16:38 +00:00
17 lines
535 B
TypeScript
17 lines
535 B
TypeScript
import { flushBandwidthToDb } from "@server/routers/newt/handleReceiveBandwidthMessage";
|
|
import { flushSiteBandwidthToDb } from "@server/routers/gerbil/receiveBandwidth";
|
|
import { cleanup as wsCleanup } from "#dynamic/routers/ws";
|
|
|
|
async function cleanup() {
|
|
await flushBandwidthToDb();
|
|
await flushSiteBandwidthToDb();
|
|
await wsCleanup();
|
|
|
|
process.exit(0);
|
|
}
|
|
|
|
export async function initCleanup() {
|
|
// Handle process termination
|
|
process.on("SIGTERM", () => cleanup());
|
|
process.on("SIGINT", () => cleanup());
|
|
} |