Configure Redis error handler and client correctly

This commit is contained in:
TSR Berry 2023-06-09 18:20:10 +02:00
parent 415a9b43ce
commit 6accc2aceb
No known key found for this signature in database
GPG key ID: 52353C0A4CCA15E2

View file

@ -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