-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Remove CancelableEnumerator #10099
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
Remove CancelableEnumerator #10099
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -406,10 +406,11 @@ private async Task StreamResultsAsync(string invocationId, HubConnectionContext | |
|
||
try | ||
{ | ||
await foreach (var streamItem in enumerable) | ||
var enumerator = enumerable.GetAsyncEnumerator(streamCts.Token); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave the await foreach and call .WithCancellation instead: await foreach (var streamItem in enumerable.WithCancellation(streamCts.Token))
{
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it should |
||
while (await enumerator.MoveNextAsync()) | ||
{ | ||
// Send the stream item | ||
await connection.WriteAsync(new StreamItemMessage(invocationId, streamItem)); | ||
await connection.WriteAsync(new StreamItemMessage(invocationId, enumerator.Current)); | ||
} | ||
} | ||
catch (ChannelClosedException ex) | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
registration
not referenced. Actually is the private class still needed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class is still needed because we need to be able to cancel the inner stream operation from the token passed into
GetASyncEnumerator
but you bring up a good point about the registration. It should be disposed