From e7aec8752c688cc0d92d8a9bbb9813fcfd11d8a9 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Thu, 10 Apr 2025 18:58:44 +0200 Subject: [PATCH] refactor(database): :fire: Remove unnecessary Redis connections --- entrypoints/api/setup.ts | 10 +--------- entrypoints/worker/setup.ts | 12 ++---------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/entrypoints/api/setup.ts b/entrypoints/api/setup.ts index fda9587e..ae0219f0 100644 --- a/entrypoints/api/setup.ts +++ b/entrypoints/api/setup.ts @@ -1,7 +1,7 @@ import { configureLoggers } from "@/loggers"; +import { connection } from "@/redis.ts"; import { getLogger } from "@logtape/logtape"; import { Note } from "@versia/kit/db"; -import IORedis from "ioredis"; import { config } from "~/config.ts"; import { setupDatabase } from "~/drizzle/db"; import { searchManager } from "../../classes/search/search-manager.ts"; @@ -37,14 +37,6 @@ serverLogger.info`Versia Server started at ${config.http.bind}:${config.http.bin serverLogger.info`Database is online, now serving ${postCount} posts`; // Check if Redis is reachable -const connection = new IORedis({ - host: config.redis.queue.host, - port: config.redis.queue.port, - password: config.redis.queue.password, - db: config.redis.queue.database, - maxRetriesPerRequest: null, -}); - await connection.ping(); serverLogger.info`Redis is online`; diff --git a/entrypoints/worker/setup.ts b/entrypoints/worker/setup.ts index 2996d697..42b200ff 100644 --- a/entrypoints/worker/setup.ts +++ b/entrypoints/worker/setup.ts @@ -1,8 +1,8 @@ import { configureLoggers } from "@/loggers"; +import { connection } from "@/redis.ts"; import { getLogger } from "@logtape/logtape"; import { Note } from "@versia/kit/db"; import chalk from "chalk"; -import IORedis from "ioredis"; import { config } from "~/config.ts"; import { setupDatabase } from "~/drizzle/db"; import { searchManager } from "../../classes/search/search-manager.ts"; @@ -14,7 +14,7 @@ await configureLoggers(); const serverLogger = getLogger("server"); console.info(` -██╗ ██╗███████╗██████╗ ███████╗██╗ █████╗ +██╗ ██╗███████╗██████╗ ███████╗██╗ █████╗ ██║ ██║██╔════╝██╔══██╗██╔════╝██║██╔══██╗ ██║ ██║█████╗ ██████╔╝███████╗██║███████║ ╚██╗ ██╔╝██╔══╝ ██╔══██╗╚════██║██║██╔══██║ @@ -39,14 +39,6 @@ serverLogger.info`Versia Server Worker started at ${config.http.bind}:${config.h serverLogger.info`Database is online, containing ${postCount} posts`; // Check if Redis is reachable -const connection = new IORedis({ - host: config.redis.queue.host, - port: config.redis.queue.port, - password: config.redis.queue.password, - db: config.redis.queue.database, - maxRetriesPerRequest: null, -}); - await connection.ping(); serverLogger.info`Redis is online`;