fix: upgrade script to handle topics that were already pruned

get the tid from the zsets intead of topic hash since its gone already
This commit is contained in:
Barış Soner Uşaklı
2026-01-25 20:03:27 -05:00
parent a82f18ccfb
commit 03b7374c69

View File

@@ -17,10 +17,16 @@ module.exports = {
async function cleanupSet(setName) {
const tidsToRemove = [];
await batch.processSortedSet(setName, async (tids) => {
const topicData = await db.getObjectsFields(tids.map(tid => `topic:${tid}`), ['tid', 'cid']);
const topicData = await db.getObjectsFields(tids.map(tid => `topic:${tid}`), ['cid']);
topicData.forEach((t, index) => {
if (t) {
t.tid = tids[index];
}
});
const batchTids = topicData.filter(
t => t && (!t.cid || !utils.isNumber(t.cid) || t.cid === -1)
).map(t => t.tid);
tidsToRemove.push(...batchTids);
progress.incr(tids.length);
}, {