delete topic post sorted sets on topic purge

v1.18.x
barisusakli 10 years ago
parent 5414c268a0
commit 23f450adbd

@ -45,7 +45,11 @@ module.exports = function(Topics) {
Topics.purge = function(tid, callback) { Topics.purge = function(tid, callback) {
async.parallel([ async.parallel([
function(next) { 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) { function(next) {
db.sortedSetsRemove(['topics:tid', 'topics:recent', 'topics:posts', 'topics:views'], tid, next); db.sortedSetsRemove(['topics:tid', 'topics:recent', 'topics:posts', 'topics:views'], tid, next);

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

Loading…
Cancel
Save