Skip to content

Commit

Permalink
Configure Redis error handler and client correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
TSRBerry committed Jun 11, 2023
1 parent 415a9b4 commit 6accc2a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ export const logger = loggerInstance.child({
// Init Redis client
export const redisClient = createClient({
url: process.env.REDIS_URL,
readonly: true,
// NOTE: Enable this if we ever start using cluster mode
// readonly: true,
});

redisClient.on("error", (err: Error) =>
loggerInstance.error("An error occurred.", { source: "Redis client", error: err })
loggerInstance.error(err.message, {
source: "Redis client",
stacktrace: err.stack,
})
);

// Init express server
Expand Down

0 comments on commit 6accc2a

Please sign in to comment.