Skip to content

Conversation

eerhardt
Copy link
Member

@eerhardt eerhardt commented Jul 2, 2024

Today we create a separate "cancelable" async enumerable so we can "link" the passed in CancellationTokenSource with the CancellationToken passed into GetAsyncEnumerator. We don't need to do this in this scenario because we are the ones enumerating over the object, and we aren't passing in a CancellationToken during the enumeration.

Instead, we can simply enumerate over the supplied IAsyncEnumerable and call WithCancellation, passing in the supplied CancellationTokenSource.

Today we create a separate "cancelable" async enumerable so we can "link" the passed in CancellationTokenSource with the CancellationToken passed into GetAsyncEnumerator. We don't need to do this in this scenario because we are the ones enumerating over the object, and we aren't passing in a CancellationToken during the enumeration.

Instead, we can simply enumerate over the supplied IAsyncEnumerable and call WithCancellation, passing in the supplied CancellationTokenSource.
@ghost ghost added the area-signalr Includes: SignalR clients and servers label Jul 2, 2024
@eerhardt eerhardt changed the title Simply SignalR Client IAsyncEnumerable usage Simplify SignalR Client IAsyncEnumerable usage Jul 2, 2024
@eerhardt eerhardt merged commit 102f4bd into dotnet:main Jul 2, 2024
@eerhardt eerhardt deleted the SimplifySignalRClientAsyncEnumerableCode branch July 2, 2024 22:14
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0-preview7 milestone Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants