Node.js based forum software built for the modern web
fix: upgrade script, dont remove while processing zset
Barış Soner Uşaklı7a23e291cf52
diff --git a/src/upgrades/4.9.0/topicsRemote_zset.js b/src/upgrades/4.9.0/topicsRemote_zset.jsindex 678b528cff..a74457c0e1 100644--- a/src/upgrades/4.9.0/topicsRemote_zset.js+++ b/src/upgrades/4.9.0/topicsRemote_zset.js@@ -10,10 +10,10 @@ module.exports = {method: async function () {const { progress } = this;progress.total = await db.sortedSetCard('topics:tid');-+ const removeTopics = [];await batch.processSortedSet('topics:tid', async (topicData) => {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('topicsRemote:tid',apTopics.map(t => t.score),@@ -24,5 +24,11 @@ module.exports = {batch: 500,withScores: true,});++ await batch.processArray(removeTopics, async (tids) => {+ await db.sortedSetRemove('topics:tid', tids);+ }, {+ batch: 500,+ });},};