mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 17:46:16 +01:00
Cache the number of replies in the post object. See #5050.
https://github.com/NodeBB/NodeBB/pull/5050#pullrequestreview-4248269
This commit is contained in:
@@ -86,7 +86,10 @@ module.exports = function (Posts) {
|
||||
if (!postData.toPid) {
|
||||
return next(null);
|
||||
}
|
||||
db.sortedSetAdd('pid:' + postData.toPid + ':replies', timestamp, postData.pid, next);
|
||||
async.parallel([
|
||||
async.apply(db.sortedSetAdd, 'pid:' + postData.toPid + ':replies', timestamp, postData.pid),
|
||||
async.apply(db.incrObjectField, 'post:' + postData.toPid, 'replies')
|
||||
], next);
|
||||
},
|
||||
function (next) {
|
||||
db.incrObjectField('global', 'postCount', next);
|
||||
|
||||
Reference in New Issue
Block a user