@resolveio/server-lib 5.0.1 → 5.0.2
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.
|
@@ -726,8 +726,17 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
726
726
|
that._mainServer.getMethodManager().callMethodInternal('insertSubscriptionLog', type, subscription.publication, collection, JSON.stringify(subscription.subscriptionData));
|
|
727
727
|
}
|
|
728
728
|
(_a = that._publications[subscription.publication].function).call.apply(_a, [Object.assign({}, that, SubscriptionManager.prototype)].concat(subscription.subscriptionData)).then(function (res) {
|
|
729
|
-
if (common_1.getBinarySize(JSON.stringify(_this._subCache))
|
|
730
|
-
_this._subCache
|
|
729
|
+
if (common_1.getBinarySize(JSON.stringify(_this._subCache)) > 750000000) {
|
|
730
|
+
var neededSize = (common_1.getBinarySize(JSON.stringify(_this._subCache))) - 750000000;
|
|
731
|
+
var neededSizeIndex = 0;
|
|
732
|
+
for (var zz = 0; zz < _this._subCache.length; zz++) {
|
|
733
|
+
neededSize -= (common_1.getBinarySize(JSON.stringify(_this._subCache[zz])));
|
|
734
|
+
neededSizeIndex++;
|
|
735
|
+
if (neededSize < 0) {
|
|
736
|
+
break;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
_this._subCache.splice(0, neededSizeIndex);
|
|
731
740
|
}
|
|
732
741
|
_this._subCache.push({ publication: subscription.publication, subscriptionData: subscription.subscriptionData, res: res });
|
|
733
742
|
var serverRes = {
|
|
@@ -795,8 +804,17 @@ var SubscriptionManager = /** @class */ (function () {
|
|
|
795
804
|
that._mainServer.getMethodManager().callMethodInternal('insertSubscriptionLog', type, subscription.publication, collection, JSON.stringify(subscription.subscriptionData));
|
|
796
805
|
}
|
|
797
806
|
(_a = that._publications[subscription.publication].function).call.apply(_a, [Object.assign({}, that, SubscriptionManager.prototype)].concat(subscription.subscriptionData)).then(function (res) {
|
|
798
|
-
if (common_1.getBinarySize(JSON.stringify(_this._subCache))
|
|
799
|
-
_this._subCache
|
|
807
|
+
if (common_1.getBinarySize(JSON.stringify(_this._subCache)) > 750000000) {
|
|
808
|
+
var neededSize = (common_1.getBinarySize(JSON.stringify(_this._subCache))) - 750000000;
|
|
809
|
+
var neededSizeIndex = 0;
|
|
810
|
+
for (var zz = 0; zz < _this._subCache.length; zz++) {
|
|
811
|
+
neededSize -= (common_1.getBinarySize(JSON.stringify(_this._subCache[zz])));
|
|
812
|
+
neededSizeIndex++;
|
|
813
|
+
if (neededSize < 0) {
|
|
814
|
+
break;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
_this._subCache.splice(0, neededSizeIndex);
|
|
800
818
|
}
|
|
801
819
|
_this._subCache.push({ publication: subscription.publication, subscriptionData: subscription.subscriptionData, res: res });
|
|
802
820
|
subscription.clients.forEach(function (client) {
|