Skip to content
Browse files

change query pausing flag default false to true

  • Loading branch information...
1 parent 98177e4 commit dee97db33cd0b2b14cbb825b996cae0303df5a24 @stomita committed
Showing with 5 additions and 2 deletions.
  1. +5 −1 lib/query.js
  2. +0 −1 test/query.test.js
View
6 lib/query.js
@@ -20,7 +20,7 @@ var Query = module.exports = function(conn, config, locator) {
}
this._locator = locator;
this._buffer = [];
- this._paused = false;
+ this._paused = true;
this._closed = false;
Query.super_.apply(this);
@@ -116,6 +116,9 @@ Query.prototype.resume = function() {
if (this._closed) {
throw new Error("resuming already closed stream");
}
+ if (!this._paused) {
+ return;
+ } // do nothing if not paused
this._paused = false;
while (!this._paused && this._buffer.length > 0) {
if (this.totalFetched >= this._maxFetch) {
@@ -156,6 +159,7 @@ Query.prototype.execute = function(options, callback) {
if (self._closed) {
throw new Error("executing already closed query");
}
+ this._paused = false; // mark pause flag to false
options = options || {};
if (typeof options === "function") {
View
1 test/query.test.js
@@ -115,7 +115,6 @@ vows.describe("query").addBatch({
self.callback(null, { query : query, records : records });
};
query.pipe(outStream);
- query.resume();
query.on("error", function(err) { self.callback(err); });
},

0 comments on commit dee97db

Please sign in to comment.
Something went wrong with that request. Please try again.