Skip to content

Commit

Permalink
Use a promise.allSettle instead of a for loop that resolves one at a …
Browse files Browse the repository at this point in the history
…time
  • Loading branch information
nturinski committed Jun 28, 2024
1 parent 7c8c16d commit 4203e3a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tree/azure/grouping/GroupingItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class GroupingItem implements ResourceGroupsItem {
items.push(new GenericItem('', { description: subscription.name }));
}

for await (const resource of subscriptionGroupingMap.get(subscription) ?? []) {
await Promise.allSettled((subscriptionGroupingMap.get(subscription) ?? []).map(async (resource): Promise<void> => {
try {
const branchDataProvider = this.branchDataProviderFactory(resource);
const resourceItem = await branchDataProvider.getResourceItem(resource);
Expand All @@ -125,7 +125,8 @@ export class GroupingItem implements ResourceGroupsItem {
} catch (e) {
items.push(new InvalidAzureResourceItem(resource, e));
}
}
}));

return items;
}));

Expand Down

0 comments on commit 4203e3a

Please sign in to comment.