mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-04 21:15:55 +01:00
feat: cleanup, use bulk
This commit is contained in:
@@ -209,10 +209,14 @@ module.exports = function (Categories) {
|
||||
|
||||
async.parallel([
|
||||
function (next) {
|
||||
db.sortedSetAdd('cid:' + cid + ':pids', postData.timestamp, postData.pid, next);
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetAdd('cid:' + cid + ':tids:lastposttime', postData.timestamp, postData.tid, next);
|
||||
const bulk = [
|
||||
['cid:' + cid + ':pids', postData.timestamp, postData.pid],
|
||||
['cid:' + cid + ':tids:lastposttime', postData.timestamp, postData.tid],
|
||||
];
|
||||
if (!pinned) {
|
||||
bulk.push(['cid:' + cid + ':tids', postData.timestamp, postData.tid]);
|
||||
}
|
||||
db.sortedSetAddBulk(bulk, next);
|
||||
},
|
||||
function (next) {
|
||||
db.incrObjectField('category:' + cid, 'post_count', next);
|
||||
@@ -221,17 +225,7 @@ module.exports = function (Categories) {
|
||||
if (pinned) {
|
||||
return setImmediate(next);
|
||||
}
|
||||
|
||||
async.parallel([
|
||||
function (next) {
|
||||
db.sortedSetAdd('cid:' + cid + ':tids', postData.timestamp, postData.tid, next);
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetIncrBy('cid:' + cid + ':tids:posts', 1, postData.tid, next);
|
||||
},
|
||||
], function (err) {
|
||||
next(err);
|
||||
});
|
||||
db.sortedSetIncrBy('cid:' + cid + ':tids:posts', 1, postData.tid, err => next(err));
|
||||
},
|
||||
function (next) {
|
||||
Categories.updateRecentTid(cid, postData.tid, next);
|
||||
|
||||
Reference in New Issue
Block a user