@resolveio/server-lib 9.6.30 → 9.6.32
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/mongo.manager.d.ts +2 -0
- package/managers/mongo.manager.js +5 -2
- package/managers/mongo.manager.js.map +1 -1
- package/managers/subscription.manager.js +1 -1
- package/managers/subscription.manager.js.map +1 -1
- package/methods/cron-jobs.js +17 -38
- package/methods/cron-jobs.js.map +1 -1
- package/package.json +1 -1
|
@@ -59,6 +59,7 @@ var log_collection_1 = require("../collections/log.collection");
|
|
|
59
59
|
var NodeCache = require("node-cache");
|
|
60
60
|
var crypto = require('crypto');
|
|
61
61
|
var scmp = require('scmp');
|
|
62
|
+
var moment = require("moment");
|
|
62
63
|
var MongoManager = /** @class */ (function () {
|
|
63
64
|
function MongoManager() {
|
|
64
65
|
this._collections = [];
|
|
@@ -85,6 +86,7 @@ var MongoManager = /** @class */ (function () {
|
|
|
85
86
|
}
|
|
86
87
|
else {
|
|
87
88
|
_mongoQueue.cbs_next.push(mongoQueue.cbs[0]);
|
|
89
|
+
_mongoQueue.next_run = moment().add(1, 'second').toDate();
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
else {
|
|
@@ -98,7 +100,7 @@ var MongoManager = /** @class */ (function () {
|
|
|
98
100
|
var _this = this;
|
|
99
101
|
return __generator(this, function (_a) {
|
|
100
102
|
setInterval(function () {
|
|
101
|
-
var queueArr = _this._mongoQueue.filter(function (a) { return !a.running && a.cbs.length; });
|
|
103
|
+
var queueArr = _this._mongoQueue.filter(function (a) { return !a.running && a.cbs.length && (!a.next_run || a.next_run.getTime() <= Date.now()); });
|
|
102
104
|
if (queueArr.length) {
|
|
103
105
|
var _loop_1 = function (i) {
|
|
104
106
|
var _a, _b, _c;
|
|
@@ -113,6 +115,7 @@ var MongoManager = /** @class */ (function () {
|
|
|
113
115
|
mongoQueue.running = false;
|
|
114
116
|
}
|
|
115
117
|
else {
|
|
118
|
+
mongoQueue.last_run = new Date();
|
|
116
119
|
if (!mongoQueue.name_function_addt) {
|
|
117
120
|
(_a = index_1.ResolveIOServer.getMainDB().collection(mongoQueue.name_collection))[mongoQueue.name_function].apply(_a, mongoQueue.data_function).then(function (res) {
|
|
118
121
|
mongoQueue.cacheId = _this._mongoQueueCacheId;
|
|
@@ -188,7 +191,7 @@ var MongoManager = /** @class */ (function () {
|
|
|
188
191
|
queueArr[zz].cacheId = 0;
|
|
189
192
|
deleteCount += 1;
|
|
190
193
|
nodeCacheSize = this._nodeCache.getStats().vsize;
|
|
191
|
-
if (nodeCacheSize <
|
|
194
|
+
if (nodeCacheSize < 750000000) {
|
|
192
195
|
break;
|
|
193
196
|
}
|
|
194
197
|
}
|