Skip to content

Commit

Permalink
chore: ServerStreaming Benchmark stopped with IOException: The reques…
Browse files Browse the repository at this point in the history
…t was aborted.
  • Loading branch information
guitarrapc committed Nov 2, 2024
1 parent 0550e3a commit 9007318
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public async ValueTask RunAsync(int connectionId, PerformanceTestRunningContext
while (!cancellationToken.IsCancellationRequested)
{
ctx.Increment();
var begin = timeProvider.GetTimestamp();
try
{
var begin = timeProvider.GetTimestamp();
await stream.ResponseStream.MoveNext(cancellationToken);
ctx.Latency(connectionId, timeProvider.GetElapsedTime(begin));
}
Expand All @@ -35,6 +35,11 @@ public async ValueTask RunAsync(int connectionId, PerformanceTestRunningContext
// canceling call is expected behavior.
break;
}
catch (RpcException ex) when (ex.StatusCode == StatusCode.Unavailable && ex.InnerException is IOException)
{
// canceling call is expected behavior.
break;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions perf/BenchmarkApp/PerformanceTest.Server/PerfTestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public async Task<ServerStreamingResult<SimpleResponse>> ServerStreamingAsync()
{
var response = SimpleResponse.Cached;
var stream = GetServerStreamingContext<SimpleResponse>();

while(!stream.ServiceContext.CallContext.CancellationToken.IsCancellationRequested)
var ct = stream.ServiceContext.CallContext.CancellationToken;
while (!ct.IsCancellationRequested)
{
await stream.WriteAsync(response);
}
Expand Down

0 comments on commit 9007318

Please sign in to comment.