-
Notifications
You must be signed in to change notification settings - Fork 790
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
React to Response.StartAsync change #144
Comments
Well no, if you do that then it'll be inefficient. You want to keep calling StartAsync so that on kestrel, it'll be optimized. |
@jtattermusch What is the current behavior of c-core when it comes to buffering? I wanted to test out whether it prevents headers from being sent but in the following code it hangs on the first public override async Task SayHellos(HelloRequest request, IServerStreamWriter<HelloReply> responseStream, ServerCallContext context)
{
responseStream.WriteOptions = new WriteOptions(WriteFlags.BufferHint);
for (int i = 0; i < 3; i++)
{
var message = $"How are you {request.Name}? {i}";
await responseStream.WriteAsync(new HelloReply
{
Message = message,
Timestamp = Timestamp.FromDateTime(DateTime.UtcNow)
});
}
await responseStream.WriteAsync(new HelloReply
{
Message = $"Goodbye {request.Name}!",
Timestamp = Timestamp.FromDateTime(DateTime.UtcNow)
});
var metadata = new Metadata();
metadata.Add("test", "value!");
await context.WriteResponseHeadersAsync(metadata);
} |
@JamesNK this was merged just now. |
WriteFlag.BufferHint only affects message writes: There might be a way to cork initial metadata too using this flag It is not clear to me why your snippet hangs (I don't see anything bad with it except trying to invoke WriteReponseHeadersAsync after calling WriteAsync will throw as that's forbidden). |
@JamesNK I ran a few experiments as of why the WriteAsync() with buffer hint hangs. |
Blocked on an answer for buffering and headers interact in Grpc.Core. |
We don't plan on doing further work on this right now. We can always revisit this decision in the future. |
StartAsync behavior is changing with dotnet/aspnetcore#7779
Delay calling StartAsync when buffering on the server so user can send HTTP headers afterwards.
The text was updated successfully, but these errors were encountered: