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

Support IAsyncEnumerable<T> prefetch without returning Task<IAsyncEnumerable<T>> #430

Closed
jdrobison opened this issue Mar 9, 2020 · 1 comment · Fixed by #443
Closed
Assignees
Milestone

Comments

@jdrobison
Copy link
Member

The .WithPrefetchAsync extension returns ValueTask<IAsyncEnumerable<T>> which means an async enumerator method has to change its signature (or add an overload) in order to support prefetching.

Can we do better?

@AArnott AArnott self-assigned this Mar 9, 2020
@AArnott
Copy link
Member

AArnott commented Apr 1, 2020

I am going to try to add a prefetch setting to JsonRpcEnumerableSettings and then add the awaiting logic within StreamJsonRpc itself.

@AArnott AArnott added this to the v2.4 milestone Apr 1, 2020
@AArnott AArnott changed the title Need a way for a method returning IAsyncEnumerable<T> to support prefetching Support IAsyncEnumerable<T> prefetch without returning Task<IAsyncEnumerable<T>> Apr 1, 2020
@AArnott AArnott modified the milestones: v2.4, v2.5 Apr 2, 2020
AArnott added a commit to AArnott/vs-streamjsonrpc that referenced this issue Apr 3, 2020
This allows RPC server methods to return IAsyncEnumerable<T> with a prefetch setting without requiring them to call an async method and thus have to return a `Task<IAsyncEnumerable<T>>` instead of the more preferable `IAsyncEnumerable<T>` directly.

Closes microsoft#430
AArnott added a commit to AArnott/vs-streamjsonrpc that referenced this issue Apr 3, 2020
…refetch setting without requiring them to call an async method and thus have to return a `Task<IAsyncEnumerable<T>>` instead of the more preferable `IAsyncEnumerable<T>` directly.

The trick here is that the `JsonRpc` class must itself perform the asynchronous `PrefetchAsync` operation after the RPC method returns but before sending the result for transmission to the formatter.

Closes microsoft#430
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants