delete topic post sorted sets on topic purge

This commit is contained in:
barisusakli
2015-01-10 17:47:31 -05:00
parent 5414c268a0
commit 23f450adbd
2 changed files with 6 additions and 9 deletions

View File

@@ -45,7 +45,11 @@ module.exports = function(Topics) {
Topics.purge = function(tid, callback) {
async.parallel([
function(next) {
db.deleteAll(['tid:' + tid + ':followers', 'tid:' + tid + ':read_by_uid'], next);
db.deleteAll([
'tid:' + tid + ':followers',
'tid:' + tid + ':posts',
'tid:' + tid + ':posts:votes'
], next);
},
function(next) {
db.sortedSetsRemove(['topics:tid', 'topics:recent', 'topics:posts', 'topics:views'], tid, next);

View File

@@ -218,14 +218,7 @@ module.exports = function(Topics) {
};
Topics.removePostFromTopic = function(tid, pid, callback) {
async.parallel([
function (next) {
db.sortedSetRemove('tid:' + tid + ':posts', pid, next);
},
function (next) {
db.sortedSetRemove('tid:' + tid + ':posts:votes', pid, next);
}
], function(err, results) {
db.sortedSetsRemove(['tid:' + tid + ':posts', 'tid:' + tid + ':posts:votes'], pid, function(err) {
if (err) {
return callback(err);
}