mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 07:25:46 +01:00
speed up category purge
using eachLimit dont emit stats on every topic delete
This commit is contained in:
@@ -86,25 +86,18 @@ var winston = require('winston'),
|
||||
var pids = [];
|
||||
if (results.topic.mainPid) {
|
||||
pids = [results.topic.mainPid].concat(results.pids);
|
||||
} else {
|
||||
pids = results.pids;
|
||||
}
|
||||
|
||||
async.parallel([
|
||||
function(next) {
|
||||
async.each(pids, posts.purge, next);
|
||||
async.eachLimit(pids, 10, posts.purge, next);
|
||||
},
|
||||
function(next) {
|
||||
topics.purge(tid, next);
|
||||
}
|
||||
], function(err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
websockets.emitTopicPostStats();
|
||||
websockets.in('topic_' + tid).emit('event:topic_purged', tid, results.topic.cid);
|
||||
websockets.in('category_' + results.topic.cid).emit('event:topic_purged', tid);
|
||||
callback();
|
||||
});
|
||||
], callback);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user