Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p-reduce replace with p-Map #142

Merged
merged 4 commits into from
Oct 20, 2021
Merged

p-reduce replace with p-Map #142

merged 4 commits into from
Oct 20, 2021

Conversation

sameer-coder
Copy link
Contributor

@sameer-coder sameer-coder commented Oct 20, 2021

This PR replaces p-reduce with p-map since it makes secret fetching concurrent.

Note: p-map v4.0 is used since the latest version(5.x) is a pure ESM module

Closes #139

Comment on lines +36 to +41
? Object.assign(
{},
...(await pMap(opts.secrets, async (value) => ({ [value]: await client.get(value) }), {
concurrency
}))
)
Copy link
Member

Choose a reason for hiding this comment

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

No need to change, but a possible alternative could have been

Suggested change
? Object.assign(
{},
...(await pMap(opts.secrets, async (value) => ({ [value]: await client.get(value) }), {
concurrency
}))
)
? Object.fromEntries(
await pMap(opts.secrets, async (value) => [ [value], await client.get(value) ], { concurrency })
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah that's better

@sameer-coder sameer-coder merged commit c3f9f58 into master Oct 20, 2021
@sameer-coder sameer-coder deleted the concurrency-update branch October 20, 2021 09:14
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.

Use p-reduce concurrency, once available
2 participants