|
|
@ -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}`));
|
|
|
|
const userCount = await db.sortedSetCard(`chat:room:${roomId}:uids`);
|
|
|
|
await Promise.all(roomIds.map(async (roomId, idx) => {
|
|
|
|
await db.setObjectField(`chat:room:${roomId}`, 'userCount', userCount);
|
|
|
|
const roomData = arrayOfRoomData[idx];
|
|
|
|
progress.total += userCount;
|
|
|
|
if (roomData) {
|
|
|
|
|
|
|
|
const userCount = await db.sortedSetCard(`chat:room:${roomId}:uids`);
|
|
|
|
|
|
|
|
await db.setObjectField(`chat:room:${roomId}`, 'userCount', userCount);
|
|
|
|
|
|
|
|
progress.total += userCount;
|
|
|
|
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
batch: 500,
|
|
|
|
batch: 500,
|
|
|
|