From 23f450adbd42e81eaa108731bccd4a57634c8365 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sat, 10 Jan 2015 17:47:31 -0500 Subject: [PATCH] delete topic post sorted sets on topic purge --- src/topics/delete.js | 6 +++++- src/topics/posts.js | 9 +-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/topics/delete.js b/src/topics/delete.js index eb4c6c43a0..de86eb7bbc 100644 --- a/src/topics/delete.js +++ b/src/topics/delete.js @@ -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); diff --git a/src/topics/posts.js b/src/topics/posts.js index 66fbb6bc4a..9e3275887f 100644 --- a/src/topics/posts.js +++ b/src/topics/posts.js @@ -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); }