mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-28 09:58:11 +03:00
Close the score import redis queue on shutdown/endtests
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user