Skip to content
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

Pass cancellation token to grpc reader #2133

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Proto.Remote/Endpoints/ServerConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ await call.RequestStream.WriteAsync(new RemoteMessage

var writer = StartWriter(combinedToken, call, cancellationTokenSource);

var reader = StartReader(call, actorSystemId, cancellationTokenSource);
var reader = StartReader(combinedToken, call, actorSystemId, cancellationTokenSource);

_logger.LogInformation("[ServerConnector][{SystemAddress}] Connected to {Address}", _system.Address,
_address);
Expand Down Expand Up @@ -299,13 +299,13 @@ private Task StartWriter(CancellationToken combinedToken, AsyncDuplexStreamingCa
});
}

private Task StartReader(AsyncDuplexStreamingCall<RemoteMessage, RemoteMessage> call, string actorSystemId, CancellationTokenSource cancellationTokenSource)
private Task StartReader(CancellationToken combinedToken, AsyncDuplexStreamingCall<RemoteMessage, RemoteMessage> call, string actorSystemId, CancellationTokenSource cancellationTokenSource)
{
return Task.Run(async () =>
{
try
{
while (await call.ResponseStream.MoveNext().ConfigureAwait(false))
while (await call.ResponseStream.MoveNext(combinedToken).ConfigureAwait(false))
{
// if (_endpoint.CancellationToken.IsCancellationRequested) continue;
var currentMessage = call.ResponseStream.Current;
Expand Down
Loading