From cb51c239f2985c6d77ca8fb3c47cfeb31e375636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 24 Jun 2019 23:05:56 -0400 Subject: [PATCH] feat: remove duped zadds, these are already in topics.onNewPostMade --- src/categories/topics.js | 9 +-------- src/database/mongo/sorted/add.js | 7 +------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/categories/topics.js b/src/categories/topics.js index fc0a8cb5fd..0da5928505 100644 --- a/src/categories/topics.js +++ b/src/categories/topics.js @@ -209,14 +209,7 @@ module.exports = function (Categories) { async.parallel([ function (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); + db.sortedSetAdd('cid:' + cid + ':pids', postData.timestamp, postData.pid, next); }, function (next) { db.incrObjectField('category:' + cid, 'post_count', next); diff --git a/src/database/mongo/sorted/add.js b/src/database/mongo/sorted/add.js index eb08de712d..61c03602f6 100644 --- a/src/database/mongo/sorted/add.js +++ b/src/database/mongo/sorted/add.js @@ -83,11 +83,6 @@ module.exports = function (db, module) { data.forEach(function (item) { bulk.find({ _key: item[0], value: String(item[2]) }).upsert().updateOne({ $set: { score: parseFloat(item[1]) } }); }); - bulk.execute(function (err) { - if (err) { - console.log(data); - } - callback(err); - }); + bulk.execute(err => callback(err)); }; };