@eleven-am/pondsocket 0.1.187 → 0.1.189

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.
@@ -221,45 +221,22 @@ _RedisClient_heartbeatInterval = new WeakMap(), _RedisClient_cleanupInterval = n
221
221
  }), __classPrivateFieldGet(this, _RedisClient_cleanupInterval, "f")), "f");
222
222
  }, _RedisClient_performConsistencyCheck = function _RedisClient_performConsistencyCheck() {
223
223
  return __awaiter(this, void 0, void 0, function* () {
224
- const consistencyCheckScript = `
225
- local active_instances = redis.call('SMEMBERS', 'distributed_instances')
226
- local all_keys = redis.call('KEYS', '*_cache:*')
227
- local inactive_keys = {}
228
- local unique_pairs = {}
229
-
230
- local active_set = {}
231
- for _, instance in ipairs(active_instances) do
232
- active_set[instance] = true
233
- end
234
-
235
- for _, key in ipairs(all_keys) do
236
- local parts = {}
237
- for part in string.gmatch(key, '[^:]+') do
238
- table.insert(parts, part)
239
- end
240
- local instance_id, endpoint_id, channel_id = parts[2], parts[3], parts[4]
241
-
242
- if not active_set[instance_id] then
243
- table.insert(inactive_keys, key)
244
- local pair = endpoint_id .. ':' .. channel_id
245
- unique_pairs[pair] = true
246
- end
247
- end
248
-
249
- if #inactive_keys > 0 then
250
- redis.call('DEL', unpack(inactive_keys))
251
- end
252
-
253
- local unique_pairs_list = {}
254
- for pair in pairs(unique_pairs) do
255
- table.insert(unique_pairs_list, pair)
256
- end
257
-
258
- return unique_pairs_list
259
- `;
260
- const [response] = yield __classPrivateFieldGet(this, _RedisClient_redisClient, "f").eval(consistencyCheckScript, 0);
261
- const uniquePairs = Array.isArray(response) ? response : response ? [response] : [];
262
- const promises = uniquePairs.map((pair) => {
224
+ const activeInstances = yield __classPrivateFieldGet(this, _RedisClient_redisClient, "f").smembers('distributed_instances');
225
+ const allKeys = yield __classPrivateFieldGet(this, _RedisClient_redisClient, "f").keys('*_cache:*');
226
+ const activeSet = new Set(activeInstances);
227
+ const inactiveKeys = [];
228
+ const uniquePairs = new Set();
229
+ for (const key of allKeys) {
230
+ const [, instanceId, endpointId, channelId] = key.split(':');
231
+ if (!activeSet.has(instanceId)) {
232
+ inactiveKeys.push(key);
233
+ uniquePairs.add(`${endpointId}:${channelId}`);
234
+ }
235
+ }
236
+ if (inactiveKeys.length > 0) {
237
+ yield __classPrivateFieldGet(this, _RedisClient_redisClient, "f").del(...inactiveKeys);
238
+ }
239
+ const promises = Array.from(uniquePairs).map((pair) => {
263
240
  const [endpointId, channelId] = pair.split(':');
264
241
  return __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_emitStateSyncEvent).call(this, endpointId, channelId);
265
242
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eleven-am/pondsocket",
3
- "version": "0.1.187",
3
+ "version": "0.1.189",
4
4
  "description": "PondSocket is a fast simple socket server",
5
5
  "keywords": [
6
6
  "socket",
@@ -40,11 +40,11 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@stylistic/eslint-plugin-ts": "^2.9.0",
43
- "@types/jest": "^29.5.13",
44
- "@types/node": "^22.7.7",
43
+ "@types/jest": "^29.5.14",
44
+ "@types/node": "^22.8.1",
45
45
  "@types/ws": "^8.5.12",
46
- "@typescript-eslint/eslint-plugin": "^8.8.0",
47
- "@typescript-eslint/parser": "^8.8.1",
46
+ "@typescript-eslint/eslint-plugin": "^8.11.0",
47
+ "@typescript-eslint/parser": "^8.11.0",
48
48
  "eslint": "^8.57.0",
49
49
  "eslint-config-prettier": "^9.1.0",
50
50
  "eslint-import-resolver-node": "^0.3.9",