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

Merge sequence of async streams into single async stream #793

Merged
merged 27 commits into from
Feb 25, 2023

Conversation

atifaziz
Copy link
Member

@atifaziz atifaziz commented Jan 14, 2021

This PR adds Merge that concurrently merges all the elements of multiple asynchronous streams into a single asynchronous stream.

An overload allows concurrency to be controlled from 1 (sequential) to some N (or maximum degree of concurrency).

When concurrency is greater than 1, elements in the resulting stream may appear out of order.

If iterations are synchronous in whole or in part then the whole or parts are yielded/streamed synchronously without causing allocations.

This PR supersedes #775.

@atifaziz atifaziz changed the title Merge async streams into one Merge sequence of async streams into single async stream Jan 14, 2021
@viceroypenguin
Copy link
Contributor

Should there also be a version with an explicit CancellationToken for those who use fluent syntax instead of foreach for processing IAsyncEnumerable<>s?

@atifaziz
Copy link
Member Author

Should there also be a version with an explicit CancellationToken for those who use fluent syntax instead of foreach for processing IAsyncEnumerable<>s?

Most probably, but this is still in draft. 😉 However, the motivation for that isn't so much to satisfy the fluent syntax members of the audience but to allow options to be changed at time of composition or evaluation.

@viceroypenguin
Copy link
Contributor

Completed in viceroypenguin/SuperLinq#35 - to be released in SuperLinq 4.1.0

@codecov
Copy link

codecov bot commented Jan 22, 2023

Codecov Report

Merging #793 (28996d4) into master (4a9041d) will not change coverage.
The diff coverage is n/a.

❗ Current head 28996d4 differs from pull request most recent head 0fb644d. Consider uploading reports for the commit 0fb644d to get more accurate results

@@           Coverage Diff           @@
##           master     #793   +/-   ##
=======================================
  Coverage   92.52%   92.52%           
=======================================
  Files         113      113           
  Lines        3440     3440           
  Branches     1024     1024           
=======================================
  Hits         3183     3183           
  Misses        192      192           
  Partials       65       65           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@atifaziz atifaziz marked this pull request as ready for review February 17, 2023 15:58
@atifaziz atifaziz self-assigned this Feb 25, 2023
@atifaziz atifaziz added this to the 3.4.0 milestone Feb 25, 2023
@atifaziz atifaziz merged commit 1ef3753 into morelinq:master Feb 25, 2023
@atifaziz atifaziz deleted the merge-async branch February 25, 2023 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants