#621, moved everything out of parallel - poster doesn't need to wait for these functions to happen

also renamed topics.markUnRead to topics.markAsUnreadForAll
v1.18.x
psychobunny 11 years ago
parent 4f97275d24
commit 0c05ee82b1

@ -135,38 +135,29 @@ var db = require('./database'),
}
Posts.getCidByPid(postData.pid, function(err, cid) {
if(err) {
return callback(err, null);
}
db.delete('cid:' + cid + ':read_by_uid');
});
async.parallel([
function(next) {
topics.markUnRead(tid, function(err) {
if(err) {
return next(err);
}
topics.markAsRead(tid, uid);
next();
});
},
function(next) {
topics.pushUnreadCount(null, next);
},
function(next) {
threadTools.notifyFollowers(tid, uid);
next();
},
function(next) {
Posts.addUserInfoToPost(postData, function(err) {
if(err) {
return next(err);
}
next();
});
topics.markAsUnreadForAll(tid, function(err) {
if(err) {
return callback(err, null);
}
], function(err, results) {
topics.markAsRead(tid, uid);
topics.pushUnreadCount();
});
threadTools.notifyFollowers(tid, uid);
Posts.addUserInfoToPost(postData, function(err) {
if(err) {
return callback(err, null);
}
callback(null, postData);
});
});

@ -701,7 +701,7 @@ var async = require('async'),
});
}
Topics.markUnRead = function(tid, callback) {
Topics.markAsUnreadForAll = function(tid, callback) {
db.delete('tid:' + tid + ':read_by_uid', callback);
}

Loading…
Cancel
Save