mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-03 11:01:20 +01:00
fix: upgrade script, dont remove while processing zset
This commit is contained in:
@@ -10,10 +10,10 @@ module.exports = {
|
|||||||
method: async function () {
|
method: async function () {
|
||||||
const { progress } = this;
|
const { progress } = this;
|
||||||
progress.total = await db.sortedSetCard('topics:tid');
|
progress.total = await db.sortedSetCard('topics:tid');
|
||||||
|
const removeTopics = [];
|
||||||
await batch.processSortedSet('topics:tid', async (topicData) => {
|
await batch.processSortedSet('topics:tid', async (topicData) => {
|
||||||
const apTopics = topicData.filter(topic => !utils.isNumber(topic.value));
|
const apTopics = topicData.filter(topic => !utils.isNumber(topic.value));
|
||||||
await db.sortedSetRemove('topics:tid', apTopics.map(topic => topic.value));
|
removeTopics.push(...apTopics.map(topic => topic.value));
|
||||||
await db.sortedSetAdd(
|
await db.sortedSetAdd(
|
||||||
'topicsRemote:tid',
|
'topicsRemote:tid',
|
||||||
apTopics.map(t => t.score),
|
apTopics.map(t => t.score),
|
||||||
@@ -24,5 +24,11 @@ module.exports = {
|
|||||||
batch: 500,
|
batch: 500,
|
||||||
withScores: true,
|
withScores: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await batch.processArray(removeTopics, async (tids) => {
|
||||||
|
await db.sortedSetRemove('topics:tid', tids);
|
||||||
|
}, {
|
||||||
|
batch: 500,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user