Add some facts to oplog.

This commit is contained in:
David Glasser
2013-10-22 23:16:52 -07:00
parent c7329ff617
commit 2d170a0971
2 changed files with 9 additions and 0 deletions

View File

@@ -287,10 +287,14 @@ MongoConnection.prototype._startOplogTailing = function (oplogUrl,
if (!_.has(callbacksByCollection, collectionName))
callbacksByCollection[collectionName] = {};
var callbackId = nextId++;
Package.facts && Package.facts.Facts.incrementServerFact(
"mongo-livedata", "oplog-watchers", 1);
callbacksByCollection[collectionName][callbackId] = callback;
return {
stop: function () {
delete callbacksByCollection[collectionName][callbackId];
Package.facts && Package.facts.Facts.incrementServerFact(
"mongo-livedata", "oplog-watchers", -1);
}
};
},

View File

@@ -22,6 +22,9 @@ MongoConnection.prototype._observeChangesWithOplog = function (
cursorDescription, callbacks) {
var self = this;
Package.facts && Package.facts.Facts.incrementServerFact(
"mongo-livedata", "oplog-observers", 1);
var phase = PHASE.INITIALIZING;
var published = new IdMap;
@@ -233,6 +236,8 @@ MongoConnection.prototype._observeChangesWithOplog = function (
stop: function () {
listenersHandle.stop();
oplogHandle.stop();
Package.facts && Package.facts.Facts.incrementServerFact(
"mongo-livedata", "oplog-observers", -1);
}
};
};