@resolveio/server-lib 20.14.26 → 20.14.28
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.
|
@@ -1318,28 +1318,11 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
1318
1318
|
};
|
|
1319
1319
|
// Throttled `loggedInLatency` method
|
|
1320
1320
|
SubscriptionManager.prototype.loggedInLatency = function (ws) {
|
|
1321
|
-
var _a, _b, _c, _d;
|
|
1322
1321
|
var now = new Date();
|
|
1323
1322
|
var newLatency = ws['latency'];
|
|
1324
1323
|
var socketId = ws['id_socket'];
|
|
1325
1324
|
var loggedInUser = this._loggedInUsers.find(function (a) { return a.id_ws === socketId; });
|
|
1326
1325
|
if (!loggedInUser) {
|
|
1327
|
-
if (typeof newLatency === 'number' && newLatency >= this.LATENCY_DEBUG_THRESHOLD_MS) {
|
|
1328
|
-
var lastRoute = this._lastRouteBySocket.get(socketId);
|
|
1329
|
-
var workerDispatcher = (_b = (_a = resolveio_server_app_1.ResolveIOServer.getMainServer()) === null || _a === void 0 ? void 0 : _a.getWorkerDispatcherManager) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
1330
|
-
var workerSnapshot = workerDispatcher && typeof workerDispatcher.getQueueSnapshot === 'function'
|
|
1331
|
-
? workerDispatcher.getQueueSnapshot()
|
|
1332
|
-
: null;
|
|
1333
|
-
console.log(new Date(), '[Latency Spike]', {
|
|
1334
|
-
latencyMs: (0, common_1.round)(newLatency),
|
|
1335
|
-
id_user: ws['id_user'] || null,
|
|
1336
|
-
user: ws['user'] || null,
|
|
1337
|
-
id_ws: socketId,
|
|
1338
|
-
lastRoute: (lastRoute === null || lastRoute === void 0 ? void 0 : lastRoute.route) || null,
|
|
1339
|
-
lastRouteAgeMs: lastRoute ? (Date.now() - lastRoute.dateMs) : null,
|
|
1340
|
-
worker: workerSnapshot
|
|
1341
|
-
});
|
|
1342
|
-
}
|
|
1343
1326
|
return;
|
|
1344
1327
|
}
|
|
1345
1328
|
var existingEntry = this.latencyBuffer.get(socketId);
|
|
@@ -1348,22 +1331,6 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
1348
1331
|
(now.getTime() - existingEntry.lastUpdate.getTime() >= this.LATENCY_UPDATE_THRESHOLD_MS) ||
|
|
1349
1332
|
(Math.abs(newLatency - existingEntry.latency) > 100) // Optional: log only significant changes
|
|
1350
1333
|
) {
|
|
1351
|
-
if (typeof newLatency === 'number' && newLatency >= this.LATENCY_DEBUG_THRESHOLD_MS) {
|
|
1352
|
-
var lastRoute = this._lastRouteBySocket.get(socketId);
|
|
1353
|
-
var workerDispatcher = (_d = (_c = resolveio_server_app_1.ResolveIOServer.getMainServer()) === null || _c === void 0 ? void 0 : _c.getWorkerDispatcherManager) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
1354
|
-
var workerSnapshot = workerDispatcher && typeof workerDispatcher.getQueueSnapshot === 'function'
|
|
1355
|
-
? workerDispatcher.getQueueSnapshot()
|
|
1356
|
-
: null;
|
|
1357
|
-
console.log(new Date(), '[Latency Spike]', {
|
|
1358
|
-
latencyMs: (0, common_1.round)(newLatency),
|
|
1359
|
-
id_user: loggedInUser.id_user,
|
|
1360
|
-
user: loggedInUser.user,
|
|
1361
|
-
id_ws: socketId,
|
|
1362
|
-
lastRoute: (lastRoute === null || lastRoute === void 0 ? void 0 : lastRoute.route) || null,
|
|
1363
|
-
lastRouteAgeMs: lastRoute ? (Date.now() - lastRoute.dateMs) : null,
|
|
1364
|
-
worker: workerSnapshot
|
|
1365
|
-
});
|
|
1366
|
-
}
|
|
1367
1334
|
// Update in-memory and buffer
|
|
1368
1335
|
loggedInUser.date = now;
|
|
1369
1336
|
this.latencyBuffer.set(socketId, { latency: newLatency, lastUpdate: now });
|