Add an index for going from a post to its replies

This commit is contained in:
Ben Lubar
2016-09-24 14:43:48 -05:00
parent 2824ce5587
commit fae28ed3cc
4 changed files with 78 additions and 1 deletions

View File

@@ -137,6 +137,17 @@ module.exports = function (Posts) {
function (next) {
deletePostFromUsersVotes(pid, next);
},
function(next) {
Posts.getPostField(pid, 'toPid', function (err, toPid) {
if (err) {
return next(err);
}
if (!parseInt(toPid, 10)) {
return next(null);
}
db.sortedSetRemove('pid:' + toPid + ':replies', pid, next);
});
},
function (next) {
db.sortedSetsRemove(['posts:pid', 'posts:flagged'], pid, next);
},