get teasers: probably faster, hopefully

v1.18.x
psychobunny 10 years ago
parent 29fd03504b
commit b5c7473c95

@ -256,14 +256,14 @@ var db = require('./database'),
}, },
teasers: function(next) { teasers: function(next) {
var teasers = []; var teasers = [];
async.eachSeries(uids, function(fromuid, next) { async.each(uids, function(fromuid, next) {
Messaging.getMessages({ Messaging.getMessages({
fromuid: fromuid, fromuid: fromuid,
touid: uid, touid: uid,
isNew: false, isNew: false,
count: 1 count: 1
}, function(err, teaser) { }, function(err, teaser) {
teasers.push(teaser[0]); teasers[uids.indexOf(fromuid)] = teaser[0];
next(err); next(err);
}); });
}, function(err) { }, function(err) {

Loading…
Cancel
Save