|
|
@ -30,17 +30,18 @@ exports.processSortedSet = function (setKey, process, options, callback) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
options.batch = options.batch || DEFAULT_BATCH_SIZE;
|
|
|
|
|
|
|
|
|
|
|
|
// use the fast path if possible
|
|
|
|
// use the fast path if possible
|
|
|
|
if (db.processSortedSet && typeof options.doneIf !== 'function' && !utils.isNumber(options.alwaysStartAt)) {
|
|
|
|
if (db.processSortedSet && typeof options.doneIf !== 'function' && !utils.isNumber(options.alwaysStartAt)) {
|
|
|
|
return db.processSortedSet(setKey, process, options.batch || DEFAULT_BATCH_SIZE, callback);
|
|
|
|
return db.processSortedSet(setKey, process, options, callback);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// custom done condition
|
|
|
|
// custom done condition
|
|
|
|
options.doneIf = typeof options.doneIf === 'function' ? options.doneIf : function () {};
|
|
|
|
options.doneIf = typeof options.doneIf === 'function' ? options.doneIf : function () {};
|
|
|
|
|
|
|
|
|
|
|
|
var batch = options.batch || DEFAULT_BATCH_SIZE;
|
|
|
|
|
|
|
|
var start = 0;
|
|
|
|
var start = 0;
|
|
|
|
var stop = batch;
|
|
|
|
var stop = options.batch;
|
|
|
|
var done = false;
|
|
|
|
var done = false;
|
|
|
|
|
|
|
|
|
|
|
|
async.whilst(
|
|
|
|
async.whilst(
|
|
|
@ -60,8 +61,8 @@ exports.processSortedSet = function (setKey, process, options, callback) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
return next(err);
|
|
|
|
return next(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
start += utils.isNumber(options.alwaysStartAt) ? options.alwaysStartAt : batch + 1;
|
|
|
|
start += utils.isNumber(options.alwaysStartAt) ? options.alwaysStartAt : options.batch + 1;
|
|
|
|
stop = start + batch;
|
|
|
|
stop = start + options.batch;
|
|
|
|
|
|
|
|
|
|
|
|
if (options.interval) {
|
|
|
|
if (options.interval) {
|
|
|
|
setTimeout(next, options.interval);
|
|
|
|
setTimeout(next, options.interval);
|
|
|
|