processSortedSet

v1.18.x
Baris Usakli 8 years ago
parent 18db0734b0
commit 753f1576ce

@ -185,7 +185,9 @@ module.exports = function (User) {
function (next) { function (next) {
db.sortedSetAdd('users:notvalidated', Date.now(), uid, next); db.sortedSetAdd('users:notvalidated', Date.now(), uid, next);
}, },
async.apply(User.reset.cleanByUid, uid), function (next) {
User.reset.cleanByUid(uid, next);
},
], function (err) { ], function (err) {
next(err); next(err);
}); });

@ -171,17 +171,12 @@ UserReset.clean = function (callback) {
}; };
UserReset.cleanByUid = function (uid, callback) { UserReset.cleanByUid = function (uid, callback) {
if (typeof callback !== 'function') {
callback = function () {};
}
var toClean = []; var toClean = [];
uid = parseInt(uid, 10); uid = parseInt(uid, 10);
async.waterfall([ async.waterfall([
async.apply(db.getSortedSetRange.bind(db), 'reset:issueDate', 0, -1), function (next) {
function (tokens, next) { batch.processSortedSet('reset:issueDate', function (tokens, next) {
batch.processArray(tokens, function (tokens, next) {
db.getObjectFields('reset:uid', tokens, function (err, results) { db.getObjectFields('reset:uid', tokens, function (err, results) {
for (var code in results) { for (var code in results) {
if (results.hasOwnProperty(code) && parseInt(results[code], 10) === uid) { if (results.hasOwnProperty(code) && parseInt(results[code], 10) === uid) {

Loading…
Cancel
Save