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

Don't close the receiver/processor when StopAsync is called #38035

Merged
merged 1 commit into from
Aug 5, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ public async Task StopAsync(CancellationToken cancellationToken)
{
if (_isSessionsEnabled)
{
await _sessionMessageProcessor.Value.Processor.CloseAsync(cancellationToken).ConfigureAwait(false);
await _sessionMessageProcessor.Value.Processor.StopProcessingAsync(cancellationToken).ConfigureAwait(false);
}
else
{
await _messageProcessor.Value.Processor.CloseAsync(cancellationToken).ConfigureAwait(false);
await _messageProcessor.Value.Processor.StopProcessingAsync(cancellationToken).ConfigureAwait(false);
}
}
else
Expand All @@ -254,8 +254,6 @@ public async Task StopAsync(CancellationToken cancellationToken)

// Try to dispatch any already received messages.
await DispatchRemainingMessages(_monitoringCycleReceiver, _monitoringCycleMessageActions, _monitoringCycleReceiveActions, cancellationToken).ConfigureAwait(false);

await _batchReceiver.Value.CloseAsync(cancellationToken).ConfigureAwait(false);
}

Started = false;
Expand Down Expand Up @@ -308,6 +306,13 @@ public void Dispose()
#pragma warning restore AZC0102 // Do not use GetAwaiter().GetResult().
}

if (_sessionMessageProcessor.IsValueCreated)
{
#pragma warning disable AZC0102 // Do not use GetAwaiter().GetResult().
_sessionMessageProcessor.Value.Processor.CloseAsync(CancellationToken.None).GetAwaiter().GetResult();
#pragma warning restore AZC0102 // Do not use GetAwaiter().GetResult().
}

if (_client.IsValueCreated)
{
#pragma warning disable AZC0102 // Do not use GetAwaiter().GetResult().
Expand Down