Close the score import redis queue on shutdown/endtests

This commit is contained in:
zkldi
2021-11-12 03:00:23 +00:00
parent 313f37673b
commit 4e233318a9
3 changed files with 10 additions and 0 deletions
@@ -5,3 +5,7 @@ import { Environment, TachiConfig } from "lib/setup/config";
const ScoreImportQueue = new Queue(`${TachiConfig.NAME} Score Import Queue`, Environment.redisUrl);
export default ScoreImportQueue;
export function CloseScoreImportQueue() {
return ScoreImportQueue.close();
}
+4
View File
@@ -14,6 +14,7 @@ import { FormatVersion } from "./lib/constants/version";
import fetch from "utils/fetch";
import http from "http";
import { CloseRedisConnection } from "external/redis/redis";
import { CloseScoreImportQueue } from "lib/score-import/worker/queue";
const logger = CreateLogCtx(__filename);
@@ -79,6 +80,9 @@ process.on("SIGTERM", () => {
logger.info("Closing Redis Connection.", { shutdownInfo: true });
CloseRedisConnection();
logger.info("Closing Score Import Queue.", { shutdownInfo: true });
CloseScoreImportQueue();
logger.info("Everything closed. Waiting for process to exit naturally.", {
shutdownInfo: true,
});
@@ -2,10 +2,12 @@ import { CloseMongoConnection } from "external/mongo/db";
import { CloseRedisPubSub } from "external/redis/redis-IPC";
import { CloseRedisConnection } from "external/redis/redis";
import { CloseServerConnection } from "./mock-api";
import { CloseScoreImportQueue } from "lib/score-import/worker/queue";
export async function CloseAllConnections() {
await CloseMongoConnection();
await CloseServerConnection();
await CloseRedisConnection();
await CloseRedisPubSub();
await CloseScoreImportQueue();
}