Fix race condition in SSE GET request initialization (#1212)
This commit is contained in:
parent
8e57ac6b0e
commit
f9dec13660
1 changed files with 6 additions and 5 deletions
|
|
@ -125,6 +125,12 @@ public sealed class StreamableHttpServerTransport : ITransport
|
|||
var primingItem = await _storeSseWriter.WriteEventAsync(SseItem.Prime<JsonRpcMessage>(), cancellationToken).ConfigureAwait(false);
|
||||
await _httpSseWriter.WriteAsync(primingItem, 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 transport is ready to accept messages via SendMessageAsync.
|
||||
await sseResponseStream.FlushAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the response to be written before returning from the handler.
|
||||
|
|
|
|||
Loading…
Reference in a new issue