Fix HttpClient timeout for long-running tools without event stream store (#1268)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: halter73 <54385+halter73@users.noreply.github.com>
This commit is contained in:
parent
ec2983b29f
commit
fb2daf2f0d
1 changed files with 172 additions and 41 deletions
|
|
@ -74,6 +74,13 @@ internal sealed partial class StreamableHttpPostTransport(
|
|||
{
|
||||
await _httpSseWriter.WriteAsync(primingItem.Value, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If there's no priming write, flush the stream to ensure HTTP response headers are
|
||||
// sent to the client now that the server is ready to process the request.
|
||||
// This prevents HttpClient timeout for long-running requests.
|
||||
await responseStream.FlushAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
// Ensure that we've sent the priming event before processing the incoming request.
|
||||
await parentTransport.MessageWriter.WriteAsync(message, cancellationToken).ConfigureAwait(false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue