speed up category purge

using eachLimit
dont emit stats on every topic delete
This commit is contained in:
barisusakli
2014-06-21 22:11:44 -04:00
parent dceeed22f7
commit a4d4e53f45
6 changed files with 53 additions and 38 deletions

View File

@@ -1,7 +1,7 @@
'use strict';
/* globals define, app, translator, socket, bootbox */
/* globals define, app, translator, socket, bootbox, ajaxify */
define('forum/categoryTools', ['forum/topic/move', 'topicSelect'], function(move, topicSelect) {
@@ -28,7 +28,7 @@ define('forum/categoryTools', ['forum/topic/move', 'topicSelect'], function(move
$('.lock_thread').on('click', function() {
var tids = topicSelect.getSelectedTids();
if (tids.length) {
socket.emit(isAny(isTopicLocked, tids) ? 'topics.unlock' : 'topics.lock', tids, onCommandComplete);
socket.emit(isAny(isTopicLocked, tids) ? 'topics.unlock' : 'topics.lock', {tids: tids, cid: CategoryTools.cid}, onCommandComplete);
}
return false;
});
@@ -36,7 +36,7 @@ define('forum/categoryTools', ['forum/topic/move', 'topicSelect'], function(move
$('.pin_thread').on('click', function() {
var tids = topicSelect.getSelectedTids();
if (tids.length) {
socket.emit(isAny(isTopicPinned, tids) ? 'topics.unpin' : 'topics.pin', tids, onCommandComplete);
socket.emit(isAny(isTopicPinned, tids) ? 'topics.unpin' : 'topics.pin', {tids: tids, cid: CategoryTools.cid}, onCommandComplete);
}
return false;
});
@@ -93,7 +93,8 @@ define('forum/categoryTools', ['forum/topic/move', 'topicSelect'], function(move
if (!confirm) {
return;
}
socket.emit('topics.' + command, tids, onCommandComplete);
socket.emit('topics.' + command, {tids: tids, cid: CategoryTools.cid}, onCommandComplete);
});
});
}
@@ -200,8 +201,13 @@ define('forum/categoryTools', ['forum/topic/move', 'topicSelect'], function(move
getTopicEl(data.tid).remove();
}
function onTopicPurged(tid) {
getTopicEl(tid).remove();
function onTopicPurged(tids) {
if (!tids) {
return;
}
for(var i=0; i<tids.length; ++i) {
getTopicEl(tids[i]).remove();
}
}
return CategoryTools;