|
|
@@ -86,7 +86,7 @@ proto._loadBatch = function _loadBatch(callback) {
|
|
|
whileShouldBreak = false, // mimic while loop break in async land
|
|
|
whileShouldReturn = false; // mimic while loop return in async land
|
|
|
return async.whilst(
|
|
|
- function test(){
|
|
|
+ function test() {
|
|
|
return !whileShouldBreak && !whileShouldReturn;
|
|
|
},
|
|
|
function(next) {
|
|
|
@@ -119,9 +119,9 @@ proto._loadBatch = function _loadBatch(callback) {
|
|
|
return next();
|
|
|
});
|
|
|
},
|
|
|
- function(err){
|
|
|
- if (whileShouldReturn){
|
|
|
- return setImmediate(function() {
|
|
|
+ function(err) {
|
|
|
+ if (whileShouldReturn) {
|
|
|
+ return async.nextTick(function() {
|
|
|
callback(err);
|
|
|
});
|
|
|
}
|
|
|
@@ -131,11 +131,11 @@ proto._loadBatch = function _loadBatch(callback) {
|
|
|
self._runner = undefined;
|
|
|
|
|
|
//NOTE: DEVIATION FROM MONGO: to ensure that the callstack does not get too large if the Runner does things syncronously
|
|
|
- if (self._firstRun || !self._currentBatch.length){
|
|
|
+ if (self._firstRun || !self._currentBatch.length) {
|
|
|
self._firstRun = false;
|
|
|
callback(err);
|
|
|
} else {
|
|
|
- return setImmediate(function(){
|
|
|
+ return async.nextTick(function() {
|
|
|
callback(err);
|
|
|
});
|
|
|
}
|