@duvdu-v1/duvdu 1.1.274 → 1.1.275

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.
@@ -22,6 +22,8 @@ let connectionPool = [];
22
22
  let currentConnectionIndex = 0;
23
23
  let totalConnectionsRequested = 0;
24
24
  let activeConnections = 0;
25
+ // Cache the RedisStore instance
26
+ let redisStoreInstance = null;
25
27
  // Parse Redis connection details
26
28
  const getRedisConfig = () => {
27
29
  // Get Redis configuration from environment variables
@@ -125,9 +127,14 @@ const redisConnection = () => __awaiter(void 0, void 0, void 0, function* () {
125
127
  });
126
128
  exports.redisConnection = redisConnection;
127
129
  const sessionStore = () => __awaiter(void 0, void 0, void 0, function* () {
130
+ // Return cached instance if available
131
+ if (redisStoreInstance) {
132
+ return redisStoreInstance;
133
+ }
128
134
  const client = (0, exports.getRedisClient)();
129
135
  console.log('[REDIS] Created session store with pooled connection');
130
- return new connect_redis_1.default({ client });
136
+ redisStoreInstance = new connect_redis_1.default({ client });
137
+ return redisStoreInstance;
131
138
  });
132
139
  exports.sessionStore = sessionStore;
133
140
  const cleanupRedis = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -141,6 +148,8 @@ const cleanupRedis = () => __awaiter(void 0, void 0, void 0, function* () {
141
148
  connectionPool = [];
142
149
  currentConnectionIndex = 0;
143
150
  activeConnections = 0;
151
+ // Reset the store instance
152
+ redisStoreInstance = null;
144
153
  console.log('[REDIS] Connection pool cleared');
145
154
  }
146
155
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.274",
3
+ "version": "1.1.275",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [