Skip to content

optimize count items with cache and clean for loop#366

Closed
SylvainSenechal wants to merge 1 commit intodevelopment/1from
test/sylvain/fix-perf-count-items
Closed

optimize count items with cache and clean for loop#366
SylvainSenechal wants to merge 1 commit intodevelopment/1from
test/sylvain/fix-perf-count-items

Conversation

@SylvainSenechal
Copy link
Contributor

do not merge


const inflights = await cursor.toArray();
// convert inflights to a map with _id: usedCapacity._inflight
const inflightsMap = inflights.reduce((map, obj) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const inflightsMap = {};
for (const obj of inflights) {
inflightsMap[obj._id] = obj.usedCapacity?._inflight || 0n;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants