Skip to content

Commit

Permalink
Add Http 202 (Accepted) for DLASE
Browse files Browse the repository at this point in the history
  • Loading branch information
sw-joelmut committed Oct 4, 2023
1 parent c2f3aea commit f5050ab
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Text.Json;
using System.Threading;
Expand Down Expand Up @@ -91,7 +92,7 @@ public async Task<ReceiveResponse> SendRequestAsync(StreamingRequest request, Ca
}
}

return await responseCompletionSource.Task.DefaultTimeOutAsync().ConfigureAwait(false);
return await responseCompletionSource.Task.DefaultTimeOutAsync().ConfigureAwait(false);
}

public async Task SendResponseAsync(Header header, StreamingResponse response, CancellationToken cancellationToken)
Expand Down Expand Up @@ -358,6 +359,8 @@ private void ProcessRequest(Guid id, ReceiveRequest request)
{
_ = Task.Run(async () =>
{
// Send an HTTP 202 (Accepted) response right away, otherwise, while under high streaming load, the conversation times out due to not having a response in the request/response time frame.
await SendResponseAsync(new Header { Id = id, Type = PayloadTypes.Response }, new StreamingResponse { StatusCode = (int)HttpStatusCode.Accepted }, _connectionCancellationToken).ConfigureAwait(false);
var streamingResponse = await _receiver.ProcessRequestAsync(request, null).ConfigureAwait(false);
await SendResponseAsync(new Header() { Id = id, Type = PayloadTypes.Response }, streamingResponse, _connectionCancellationToken).ConfigureAwait(false);
Expand Down

0 comments on commit f5050ab

Please sign in to comment.