Skip to content

Node.js based forum software built for the modern web

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

psychobunny0c05ee82b1e7
diff --git a/src/posts.js b/src/posts.js
index 054ae82a52..e17e22f300 100644
--- a/src/posts.js
+++ b/src/posts.js
@@ -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);
});
});
diff --git a/src/topics.js b/src/topics.js
index f5a496bc77..8e5f4a3f43 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -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);
}