Skip to content

Commit

Permalink
fix(master): connect redis correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas950 committed Dec 27, 2023
1 parent f7a5c76 commit e531d88
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions apps/master/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"debug": "^4.3.4",
"ioredis": "^5.0.1",
"mongodb": "^5.1.0",
"p-event": "^6.0.0",
"source-map-support": "^0.5.21"
},
"devDependencies": {
Expand Down
8 changes: 3 additions & 5 deletions apps/master/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Redis } from "ioredis";

import calculatePresenceUsage from "./util/calculatePresenceUsage.js";
import updateScience from "./util/updateScience.js";
import { pEvent } from "p-event";

if (process.env.NODE_ENV !== "production")
(await import("dotenv")).config({ path: "../../../.env" });
Expand Down Expand Up @@ -39,11 +40,8 @@ export const redis = new Redis({

debug.enable("API-Master*");

mainLog("Connecting to MongoDB...");
await mongo.connect();
mainLog("Connecting to Redis...");
await redis.connect();

mainLog("Connecting to MongoDB and Redis...");
await Promise.all([mongo.connect(), pEvent(redis, "connect")]);
mainLog("Connected!");

await Promise.all([updateScience(), calculatePresenceUsage()]);
Expand Down
15 changes: 15 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e531d88

Please sign in to comment.