mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
perf: faster upgrade script
This commit is contained in:
@@ -21,12 +21,14 @@ module.exports = {
|
|||||||
progress.total = allRoomIds.length;
|
progress.total = allRoomIds.length;
|
||||||
await batch.processArray(allRoomIds, async (roomIds) => {
|
await batch.processArray(allRoomIds, async (roomIds) => {
|
||||||
progress.incr(roomIds.length);
|
progress.incr(roomIds.length);
|
||||||
await Promise.all(roomIds.map(async (roomId) => {
|
const [arrayOfUids, arrayOfRoomData] = await Promise.all([
|
||||||
const [uids, roomData] = await Promise.all([
|
db.getSortedSetsMembers(roomIds.map(roomId => `chat:room:${roomId}:uids`)),
|
||||||
db.getSortedSetRange(`chat:room:${roomId}:uids`, 0, -1),
|
db.getObjects(roomIds.map(roomId => `chat:room:${roomId}`)),
|
||||||
db.getObject(`chat:room:${roomId}`),
|
]);
|
||||||
]);
|
|
||||||
|
|
||||||
|
await Promise.all(roomIds.map(async (roomId, index) => {
|
||||||
|
const uids = arrayOfUids[index];
|
||||||
|
const roomData = arrayOfRoomData[index];
|
||||||
if (!uids.length && !roomData) {
|
if (!uids.length && !roomData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user