redis-abstraction 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redis-abstraction",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "A Redis client pool with abstraction to different Redis libraries.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -36,6 +36,10 @@ class RedisClientPool {
36
36
  return __awaiter(this, void 0, void 0, function* () {
37
37
  if (!this.activeRedisClients.has(token)) {
38
38
  const availableClient = this.poolRedisClients.pop() || (() => { this.totalConnectionCounter += 1; return this.redisConnectionCreator(); })();
39
+ if ((availableClient.isOpen && availableClient.isReady) === false) {
40
+ //For some reason the new Redis client closes connection if the connection is left idle for a while. So we need to check if the connection is open before using it.
41
+ yield availableClient.connect();
42
+ }
39
43
  this.activeRedisClients.set(token, availableClient);
40
44
  }
41
45
  });