@resolveio/server-lib 20.14.42 → 20.14.45
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/managers/subscription.manager.d.ts +2 -0
- package/managers/subscription.manager.js +21 -4
- package/managers/subscription.manager.js.map +1 -1
- package/managers/websocket.manager.d.ts +4 -2
- package/managers/websocket.manager.js +6 -5
- package/managers/websocket.manager.js.map +1 -1
- package/managers/worker-dispatcher.manager.js +1 -1
- package/managers/worker-dispatcher.manager.js.map +1 -1
- package/package.json +1 -1
|
@@ -37,6 +37,7 @@ export declare class SubscriptionManager {
|
|
|
37
37
|
private _debugSendQueueHits;
|
|
38
38
|
private _debugRemoveCacheHits;
|
|
39
39
|
private _subSendDebug;
|
|
40
|
+
private _subSendLogEnabled;
|
|
40
41
|
private _subSendLogThresholdMs;
|
|
41
42
|
private _subSendLogBytes;
|
|
42
43
|
private _subSendLogSampleRate;
|
|
@@ -101,6 +102,7 @@ export declare class SubscriptionManager {
|
|
|
101
102
|
private resolveResumeTokenMaxAgeMs;
|
|
102
103
|
private resolveConnectDebug;
|
|
103
104
|
private resolveSubSendDebug;
|
|
105
|
+
private resolveSubSendLogEnabled;
|
|
104
106
|
private resolveSubSendLogThresholdMs;
|
|
105
107
|
private resolveSubSendLogBytes;
|
|
106
108
|
private resolveSubSendLogSampleRate;
|
|
@@ -147,6 +147,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
147
147
|
this._debugSendQueueHits = 0;
|
|
148
148
|
this._debugRemoveCacheHits = 0;
|
|
149
149
|
this._subSendDebug = false;
|
|
150
|
+
this._subSendLogEnabled = false;
|
|
150
151
|
this._subSendLogThresholdMs = 0;
|
|
151
152
|
this._subSendLogBytes = 0;
|
|
152
153
|
this._subSendLogSampleRate = 1;
|
|
@@ -232,6 +233,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
232
233
|
this._wss = wss;
|
|
233
234
|
this._connectDebug = this.resolveConnectDebug();
|
|
234
235
|
this._subSendDebug = this.resolveSubSendDebug();
|
|
236
|
+
this._subSendLogEnabled = this.resolveSubSendLogEnabled();
|
|
235
237
|
this._subSendLogThresholdMs = this.resolveSubSendLogThresholdMs();
|
|
236
238
|
this._subSendLogBytes = this.resolveSubSendLogBytes();
|
|
237
239
|
this._subSendLogSampleRate = this.resolveSubSendLogSampleRate();
|
|
@@ -1248,6 +1250,17 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
1248
1250
|
|| config['SUBSCRIPTION_SEND_DEBUG'];
|
|
1249
1251
|
return this.parseDebugFlag(raw);
|
|
1250
1252
|
};
|
|
1253
|
+
SubscriptionManager.prototype.resolveSubSendLogEnabled = function () {
|
|
1254
|
+
var config = this.serverConfig || resolveio_server_app_1.ResolveIOServer.getServerConfig() || {};
|
|
1255
|
+
var raw = process.env.SUB_SEND_LOG_ENABLED
|
|
1256
|
+
|| process.env.SUBSCRIPTION_SEND_LOG_ENABLED
|
|
1257
|
+
|| config['SUB_SEND_LOG_ENABLED']
|
|
1258
|
+
|| config['SUBSCRIPTION_SEND_LOG_ENABLED'];
|
|
1259
|
+
if (raw === undefined || raw === null || raw === '') {
|
|
1260
|
+
return this._subSendDebug;
|
|
1261
|
+
}
|
|
1262
|
+
return this.parseDebugFlag(raw);
|
|
1263
|
+
};
|
|
1251
1264
|
SubscriptionManager.prototype.resolveSubSendLogThresholdMs = function () {
|
|
1252
1265
|
var config = this.serverConfig || resolveio_server_app_1.ResolveIOServer.getServerConfig() || {};
|
|
1253
1266
|
var raw = process.env.SUB_SEND_LOG_THRESHOLD_MS
|
|
@@ -1308,6 +1321,9 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
1308
1321
|
return fallback;
|
|
1309
1322
|
};
|
|
1310
1323
|
SubscriptionManager.prototype.shouldLogSubSend = function (durationMs, payloadBytes) {
|
|
1324
|
+
if (!this._subSendLogEnabled) {
|
|
1325
|
+
return false;
|
|
1326
|
+
}
|
|
1311
1327
|
if (this._subSendLogSampleRate < 1 && Math.random() > this._subSendLogSampleRate) {
|
|
1312
1328
|
return false;
|
|
1313
1329
|
}
|
|
@@ -2255,7 +2271,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
2255
2271
|
dependencySnapshot = execution.snapshot;
|
|
2256
2272
|
this.updateSubscriptionDependencies(sub, dependencySnapshot);
|
|
2257
2273
|
if (execution.packedResult) {
|
|
2258
|
-
this._websocketManager.sendPackedBuffer(ws, messageId, false, execution.packedResult, execution.encoding || 'msgpack');
|
|
2274
|
+
this._websocketManager.sendPackedBuffer(ws, messageId, false, execution.packedResult, execution.encoding || 'msgpack', { passThrough: !!execution.workerUsed });
|
|
2259
2275
|
}
|
|
2260
2276
|
else {
|
|
2261
2277
|
serverRes = {
|
|
@@ -2320,7 +2336,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
2320
2336
|
// Fetch pub once, send to all clients linked to this pub
|
|
2321
2337
|
SubscriptionManager.prototype.sendDataToAll = function (sub, collection, type) {
|
|
2322
2338
|
return __awaiter(this, void 0, void 0, function () {
|
|
2323
|
-
var activeClients, _a, _b, client, ws, subIndex, monitor, res, dependencySnapshot, execution, packedRes, payloadBytes, shouldCache, cachedBuffer, isSame, sendStartMs, sentClients, activeClients_1, activeClients_1_1, entry, client, ws, serverRes, sendStartMs, sentClients, activeClients_2, activeClients_2_1, entry, client, ws, serverRes, nodeCacheSize, deleteCount, subArr, zz, err_2, _c, normalizedError, correlationId, _d, _e, client, ws, serverRes, errorPayload;
|
|
2339
|
+
var activeClients, _a, _b, client, ws, subIndex, monitor, res, dependencySnapshot, execution, packedRes, passThrough, payloadBytes, shouldCache, cachedBuffer, isSame, sendStartMs, sentClients, activeClients_1, activeClients_1_1, entry, client, ws, serverRes, sendStartMs, sentClients, activeClients_2, activeClients_2_1, entry, client, ws, serverRes, nodeCacheSize, deleteCount, subArr, zz, err_2, _c, normalizedError, correlationId, _d, _e, client, ws, serverRes, errorPayload;
|
|
2324
2340
|
var e_6, _f, e_7, _g, e_8, _h, e_9, _j;
|
|
2325
2341
|
var _k, _l;
|
|
2326
2342
|
return __generator(this, function (_m) {
|
|
@@ -2375,6 +2391,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
2375
2391
|
dependencySnapshot = execution.snapshot;
|
|
2376
2392
|
this.updateSubscriptionDependencies(sub, dependencySnapshot);
|
|
2377
2393
|
packedRes = (_k = execution.packedResult) !== null && _k !== void 0 ? _k : this.packCachePayload(res);
|
|
2394
|
+
passThrough = !!execution.workerUsed;
|
|
2378
2395
|
payloadBytes = packedRes ? packedRes.byteLength : null;
|
|
2379
2396
|
shouldCache = this.shouldCachePayload(sub, packedRes);
|
|
2380
2397
|
if (sub.cacheId) {
|
|
@@ -2388,7 +2405,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
2388
2405
|
entry = activeClients_1_1.value;
|
|
2389
2406
|
client = entry.client, ws = entry.ws;
|
|
2390
2407
|
if (packedRes) {
|
|
2391
|
-
this._websocketManager.sendPackedBuffer(ws, client.messageId, false, packedRes, execution.encoding || 'msgpack');
|
|
2408
|
+
this._websocketManager.sendPackedBuffer(ws, client.messageId, false, packedRes, execution.encoding || 'msgpack', { passThrough: passThrough });
|
|
2392
2409
|
}
|
|
2393
2410
|
else {
|
|
2394
2411
|
serverRes = {
|
|
@@ -2439,7 +2456,7 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
2439
2456
|
entry = activeClients_2_1.value;
|
|
2440
2457
|
client = entry.client, ws = entry.ws;
|
|
2441
2458
|
if (packedRes) {
|
|
2442
|
-
this._websocketManager.sendPackedBuffer(ws, client.messageId, false, packedRes, execution.encoding || 'msgpack');
|
|
2459
|
+
this._websocketManager.sendPackedBuffer(ws, client.messageId, false, packedRes, execution.encoding || 'msgpack', { passThrough: passThrough });
|
|
2443
2460
|
}
|
|
2444
2461
|
else {
|
|
2445
2462
|
serverRes = {
|