mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 05:55:48 +01:00
fast path for mongodb batches (otherwise it's O(n^2) memory, which gets ugly fast)
This commit is contained in:
@@ -23,6 +23,11 @@ var async = require('async'),
|
||||
return callback(new Error('[[error:process-not-a-function]]'));
|
||||
}
|
||||
|
||||
// use the fast path if possible
|
||||
if (db.processSortedSet && typeof options.doneIf !== 'function' && !utils.isNumber(options.alwaysStartAt)) {
|
||||
return db.processSortedSet(setKey, process, options.batch || DEFAULT_BATCH_SIZE, callback);
|
||||
}
|
||||
|
||||
// custom done condition
|
||||
options.doneIf = typeof options.doneIf === 'function' ? options.doneIf : function(){};
|
||||
|
||||
@@ -58,4 +63,4 @@ var async = require('async'),
|
||||
);
|
||||
};
|
||||
|
||||
}(exports));
|
||||
}(exports));
|
||||
|
||||
Reference in New Issue
Block a user