Skip to content

Commit

Permalink
nest pMaps - pMap over rule.actions in case the number of promises is…
Browse files Browse the repository at this point in the history
… larger than max call stack.
  • Loading branch information
dhurley14 committed Jan 4, 2022
1 parent 8ee2dc4 commit a90ec5a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@ export const migrateLegacyActionsIds = async (
if (isImportRule(rule)) {
// can we swap the pre 8.0 action connector(s) id with the new,
// post-8.0 action id (swap the originId for the new _id?)
const newActions: Array<Action | Error> = await Promise.all(
rule.actions.map((action: Action) => swapActionIds(action, savedObjectsClient))
const newActions: Array<Action | Error> = await pMap(
rule.actions,
(action: Action) => swapActionIds(action, savedObjectsClient),
{ concurrency: MAX_CONCURRENT_SEARCHES }
);

// were there any errors discovered while trying to migrate and swap the action connector ids?
Expand Down

0 comments on commit a90ec5a

Please sign in to comment.