use processSortedSet instead of getting all users

This commit is contained in:
barisusakli
2014-10-26 20:10:57 -04:00
parent 782896997d
commit c4a39c8163
5 changed files with 34 additions and 46 deletions

View File

@@ -34,11 +34,7 @@ module.exports = function(User) {
}
function deleteSortedSetElements(set, deleteMethod, callback) {
batch.processSortedSet(set, function(err, ids, next) {
if (err) {
return callback(err);
}
batch.processSortedSet(set, function(ids, next) {
async.eachLimit(ids, 10, deleteMethod, next);
}, {alwaysStartAt: 0}, callback);
}