mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-25 03:31:14 +02:00
don't set and read from topic hash in parallel (#6831)
this was causing a test to fail, although very rarely
This commit is contained in:
committed by
GitHub
parent
28f2144933
commit
a0f5461860
@@ -250,31 +250,27 @@ module.exports = function (Topics) {
|
||||
};
|
||||
|
||||
Topics.updateLastPostTime = function (tid, lastposttime, callback) {
|
||||
async.parallel([
|
||||
function (next) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
Topics.getTopicFields(tid, ['cid', 'deleted', 'pinned'], next);
|
||||
},
|
||||
function (topicData, next) {
|
||||
var tasks = [
|
||||
async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids:lastposttime', lastposttime, tid),
|
||||
];
|
||||
|
||||
if (parseInt(topicData.deleted, 10) !== 1) {
|
||||
tasks.push(async.apply(Topics.updateRecent, tid, lastposttime));
|
||||
}
|
||||
|
||||
if (parseInt(topicData.pinned, 10) !== 1) {
|
||||
tasks.push(async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids', lastposttime, tid));
|
||||
}
|
||||
async.series(tasks, next);
|
||||
},
|
||||
], next);
|
||||
},
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
Topics.setTopicField(tid, 'lastposttime', lastposttime, next);
|
||||
},
|
||||
function (next) {
|
||||
Topics.getTopicFields(tid, ['cid', 'deleted', 'pinned'], next);
|
||||
},
|
||||
function (topicData, next) {
|
||||
var tasks = [
|
||||
async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids:lastposttime', lastposttime, tid),
|
||||
];
|
||||
|
||||
if (parseInt(topicData.deleted, 10) !== 1) {
|
||||
tasks.push(async.apply(Topics.updateRecent, tid, lastposttime));
|
||||
}
|
||||
|
||||
if (parseInt(topicData.pinned, 10) !== 1) {
|
||||
tasks.push(async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids', lastposttime, tid));
|
||||
}
|
||||
async.series(tasks, next);
|
||||
},
|
||||
], function (err) {
|
||||
callback(err);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user