chore: Improve graceful server shutdown (#4625)

* chore: Improve graceful server shutdown

* Replace node timers with custom promise timeout
This commit is contained in:
Tom Moor
2022-12-31 21:56:27 +00:00
committed by GitHub
parent ad9525bfa3
commit 05a4f050bb
16 changed files with 160 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ import { snakeCase } from "lodash";
import env from "@server/env";
import Metrics from "@server/logging/Metrics";
import Redis from "../redis";
import ShutdownHelper, { ShutdownOrder } from "./ShutdownHelper";
export function createQueue(
name: string,
@@ -57,5 +58,9 @@ export function createQueue(
}, 5 * 1000);
}
ShutdownHelper.add(name, ShutdownOrder.normal, async () => {
await queue.close();
});
return queue;
}