fix: one more upgrade script fix

isekai-main
Barış Soner Uşaklı 1 year ago
parent 5a8e6af43e
commit b5d1e9176b

@ -20,10 +20,14 @@ module.exports = {
// calculate user count and set progress.total // calculate user count and set progress.total
await batch.processArray(allRoomIds, async (roomIds) => { await batch.processArray(allRoomIds, async (roomIds) => {
await Promise.all(roomIds.map(async (roomId) => { 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`); const userCount = await db.sortedSetCard(`chat:room:${roomId}:uids`);
await db.setObjectField(`chat:room:${roomId}`, 'userCount', userCount); await db.setObjectField(`chat:room:${roomId}`, 'userCount', userCount);
progress.total += userCount; progress.total += userCount;
}
})); }));
}, { }, {
batch: 500, batch: 500,

Loading…
Cancel
Save