@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.
- package/abstracts/redisClient.js +16 -39
- package/package.json +5 -5
package/abstracts/redisClient.js
CHANGED
|
@@ -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
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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.
|
|
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.
|
|
44
|
-
"@types/node": "^22.
|
|
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.
|
|
47
|
-
"@typescript-eslint/parser": "^8.
|
|
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",
|