@resolveio/server-lib 12.0.72 → 12.0.74

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.
@@ -67,6 +67,8 @@ var NodeCache = require("node-cache");
67
67
  var crypto = require('crypto');
68
68
  var scmp = require('scmp');
69
69
  var monitor_manager_1 = require("./monitor.manager");
70
+ var os_1 = require("os");
71
+ var numCPUs = os_1.cpus().length;
70
72
  var v8 = require('v8');
71
73
  var MongoManager = /** @class */ (function () {
72
74
  function MongoManager() {
@@ -77,13 +79,12 @@ var MongoManager = /** @class */ (function () {
77
79
  this._mongoQueueRunning = false;
78
80
  this._mongoQueueCacheId = 1;
79
81
  this._heapStats = v8.getHeapStatistics();
80
- this._heapLimit = 0;
82
+ this._heapLimit = this._heapStats.heap_size_limit / numCPUs / 8;
81
83
  this._serverCollections = [];
82
84
  this._debugMongoQueueHits = 0;
83
85
  this._debugRemoveCacheHits = 0;
84
86
  this._debugMongoQueueCollections = [];
85
87
  this._nodeCache = new NodeCache({ stdTTL: 0, checkperiod: 0 });
86
- this._heapLimit = this._heapStats.heap_size_limit / 8;
87
88
  index_1.ResolveIOServer.getMainDB().listCollections().toArray().then(function (collections) {
88
89
  _this._serverCollections = collections.map(function (a) { return a.name; });
89
90
  });