@hastehaul/common 2.0.45 → 2.0.46
Sign up to get free protection for your applications and to get access to all the features.
@@ -38,6 +38,12 @@ class RedisClient {
|
|
38
38
|
constructor(masterHost, replicaHosts) {
|
39
39
|
this.master = new ioredis_1.default({ host: masterHost, port: 6379 });
|
40
40
|
this.replicas = replicaHosts.map(replicaHost => new ioredis_1.default({ host: replicaHost, port: 6379 }));
|
41
|
+
this.master.on("connect", () => console.info("Redis Server Connected!"));
|
42
|
+
this.master.on("error", (error) => console.error("Error in Redis", error.message));
|
43
|
+
this.replicas.forEach((client) => {
|
44
|
+
client.on('connect', () => console.log('Replica connected'));
|
45
|
+
client.on('error', (error) => console.log('Replica connected', error.message));
|
46
|
+
});
|
41
47
|
}
|
42
48
|
// get client(): IORedis {
|
43
49
|
// if(!this._redisClient) throw new Error("Cannot access Redis Client before connecting")
|