Node.js based forum software built for the modern web
fix: one more upgrade script fix
Barış Soner Uşaklıb5d1e9176bce
diff --git a/src/upgrades/3.3.0/chat_room_refactor.js b/src/upgrades/3.3.0/chat_room_refactor.jsindex 97fe6d6287..9b4f6a4096 100644--- a/src/upgrades/3.3.0/chat_room_refactor.js+++ b/src/upgrades/3.3.0/chat_room_refactor.js@@ -20,10 +20,14 @@ module.exports = {// calculate user count and set progress.totalawait batch.processArray(allRoomIds, async (roomIds) => {- await Promise.all(roomIds.map(async (roomId) => {- const userCount = await db.sortedSetCard(`chat:room:${roomId}:uids`);- await db.setObjectField(`chat:room:${roomId}`, 'userCount', userCount);- progress.total += userCount;+ const arrayOfRoomData = await db.getObjects(roomIds.map(roomId => `chat:room:${roomId}`));+ await Promise.all(roomIds.map(async (roomId, idx) => {+ const roomData = arrayOfRoomData[idx];+ if (roomData) {+ const userCount = await db.sortedSetCard(`chat:room:${roomId}:uids`);+ await db.setObjectField(`chat:room:${roomId}`, 'userCount', userCount);+ progress.total += userCount;+ }}));}, {batch: 500,