chore: Improve graceful server shutdown (#4625)
* chore: Improve graceful server shutdown * Replace node timers with custom promise timeout
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user