v1.18.x
psychobunny
parent 7bdbe7d9db
commit 06eabbc507

@ -489,16 +489,14 @@ Upgrade.upgrade = function (callback) {
require('./batch').processSortedSet('posts:pid', function (pids, next) { require('./batch').processSortedSet('posts:pid', function (pids, next) {
async.each(pids, function (pid, next) { async.each(pids, function (pid, next) {
async.each(pids, function (pid, next) { db.getObjectFields('post:' + pid, ['upvotes', 'downvotes'], function (err, postData) {
db.getObjectFields('post:' + pid, ['upvotes', 'downvotes'], function (err, postData) { if (err || !postData) {
if (err || !postData) { return next(err);
return next(err); }
}
var votes = parseInt(postData.upvotes || 0, 10) - parseInt(postData.downvotes || 0, 10); var votes = parseInt(postData.upvotes || 0, 10) - parseInt(postData.downvotes || 0, 10);
db.sortedSetAdd('posts:votes', votes, pid, next); db.sortedSetAdd('posts:votes', votes, pid, next);
}); });
}, next);
}, next); }, next);
}, {}, function (err) { }, {}, function (err) {
if (err) { if (err) {

Loading…
Cancel
Save