feat: remove duped zadds, these are already in topics.onNewPostMade

v1.18.x
Barış Soner Uşaklı 6 years ago
parent f8a7cf7378
commit cb51c239f2

@ -209,14 +209,7 @@ module.exports = function (Categories) {
async.parallel([ async.parallel([
function (next) { function (next) {
const bulk = [ db.sortedSetAdd('cid:' + cid + ':pids', postData.timestamp, postData.pid, next);
['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) { function (next) {
db.incrObjectField('category:' + cid, 'post_count', next); db.incrObjectField('category:' + cid, 'post_count', next);

@ -83,11 +83,6 @@ module.exports = function (db, module) {
data.forEach(function (item) { data.forEach(function (item) {
bulk.find({ _key: item[0], value: String(item[2]) }).upsert().updateOne({ $set: { score: parseFloat(item[1]) } }); bulk.find({ _key: item[0], value: String(item[2]) }).upsert().updateOne({ $set: { score: parseFloat(item[1]) } });
}); });
bulk.execute(function (err) { bulk.execute(err => callback(err));
if (err) {
console.log(data);
}
callback(err);
});
}; };
}; };

Loading…
Cancel
Save