v1.18.x
Baris Soner Usakli 12 years ago
parent d6bd801561
commit 883f029a3a

@ -340,26 +340,29 @@ var config = require('../config.js'),
}; };
User.get_user_postdetails = function(uids, callback) { User.get_user_postdetails = function(uids, callback) {
var multi_queue = RDB.db.multi();
for(var i=0, ii=uids.length; i<ii; ++i) {
multi_queue = multi_queue.hmget(uids[i], 'username', 'reputation');
}
var usernames = []; var usernames = [];
var reputations = []; var reputations = [];
for(var i=0, ii=uids.length; i<ii; ++i) { multi_queue.exec(function (err, replies) {
User.getUserFields(uids[i], ['username','reputation'], function(data){ replies.forEach(function (reply, index) {
usernames.push(reply[0]);
usernames.push(data['username']); reputations.push(reply[1]);
reputations.push(data['reputation']);
if(usernames.length >= uids.length) {
callback({
'username':usernames,
'rep':reputations
});
}
}); });
}
callback({
'username':usernames,
'rep':reputations
});
});
} }
User.get_uid_by_email = function(email, callback) { User.get_uid_by_email = function(email, callback) {

Loading…
Cancel
Save