use logger
This commit is contained in:
1 parent
3ff0f6d399
commit
942104aea2
1 file changed
+11
-2
@@ -22,13 +22,22 @@ class RedisService {
|
|||||||
async closeAllConnections() {
|
async closeAllConnections() {
|
||||||
const closePromises = Array.from(this.connections).map((conn) =>
|
const closePromises = Array.from(this.connections).map((conn) =>
|
||||||
conn.quit().catch((err) => {
|
conn.quit().catch((err) => {
|
||||||
console.error("Error closing Redis connection:", err);
|
this.logger.error({
|
||||||
|
message: "Error closing Redis connection",
|
||||||
|
service: SERVICE_NAME,
|
||||||
|
method: "closeAllConnections",
|
||||||
|
details: { error: err },
|
||||||
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
await Promise.all(closePromises);
|
await Promise.all(closePromises);
|
||||||
this.connections.clear();
|
this.connections.clear();
|
||||||
console.log("All Redis connections closed");
|
this.logger.info({
|
||||||
|
message: "All Redis connections closed",
|
||||||
|
service: SERVICE_NAME,
|
||||||
|
method: "closeAllConnections",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async flushRedis() {
|
async flushRedis() {
|
||||||
|
|||||||
Reference in new issue
Block a user