|
|
|
@ -908,7 +908,7 @@ Upgrade.upgrade = function (callback) {
|
|
|
|
|
next();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
function(next) {
|
|
|
|
|
function (next) {
|
|
|
|
|
thisSchemaDate = Date.UTC(2016, 9, 14);
|
|
|
|
|
|
|
|
|
|
if (schemaDate < thisSchemaDate) {
|
|
|
|
@ -917,20 +917,23 @@ Upgrade.upgrade = function (callback) {
|
|
|
|
|
|
|
|
|
|
var posts = require('./posts');
|
|
|
|
|
var batch = require('./batch');
|
|
|
|
|
batch.processSortedSet('posts:pid', function(ids, next) {
|
|
|
|
|
posts.getPostsFields(ids, ['pid', 'toPid', 'timestamp'], function(err, data) {
|
|
|
|
|
batch.processSortedSet('posts:pid', function (ids, next) {
|
|
|
|
|
posts.getPostsFields(ids, ['pid', 'toPid', 'timestamp'], function (err, data) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return next(err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async.each(data, function(postData, next) {
|
|
|
|
|
async.each(data, function (postData, next) {
|
|
|
|
|
if (!parseInt(post.toPid, 10)) {
|
|
|
|
|
return next(null);
|
|
|
|
|
}
|
|
|
|
|
db.sortedSetAdd('pid:' + postData.toPid + ':replies', postData.timestamp, postData.pid, next);
|
|
|
|
|
async.parallel([
|
|
|
|
|
async.apply(db.sortedSetAdd, 'pid:' + postData.toPid + ':replies', postData.timestamp, postData.pid),
|
|
|
|
|
async.apply(db.incrObjectField, 'post:' + postData.toPid, 'replies')
|
|
|
|
|
], next);
|
|
|
|
|
}, next);
|
|
|
|
|
});
|
|
|
|
|
}, function(err) {
|
|
|
|
|
}, function (err) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return next(err);
|
|
|
|
|
}
|
|
|
|
|