Fix "Cursor is closed" intermittent error.

If the initial _doPoll didn't complete before the first markDirty, two doPolls could be running at once, causing badness.
This commit is contained in:
Nick Martin
2012-05-24 19:40:27 -07:00
parent 57b13fd174
commit 8991c8bb25

View File

@@ -436,7 +436,9 @@ _Mongo.LiveResultsSet = function (cursor, options) {
self.removed = options.removed;
// run the first _poll() cycle synchronously.
self.poll_running = true;
self._doPoll();
self.poll_running = false;
// every once and a while, poll even if we don't think we're dirty,
// for eventual consistency with database writes from outside the