Removed unnecessary Task.Run in OnConnectionAsync methods - #9650
Merged
Merged
Conversation
Contributor
Author
|
@dotnet-policy-service agree company="AFAS Software" |
ReubenBond
approved these changes
Nov 21, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes unnecessary Task.Run wrappers in the OnConnectionAsync methods for both TlsClientConnectionMiddleware and TlsServerConnectionMiddleware. The change directly returns the Task from InnerOnConnectionAsync instead of wrapping it in Task.Run.
Changes:
- Simplified
OnConnectionAsyncto directly returnInnerOnConnectionAsync(context)inTlsServerConnectionMiddleware - Simplified
OnConnectionAsyncto directly returnInnerOnConnectionAsync(context)inTlsClientConnectionMiddleware
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Orleans.Connections.Security/Security/TlsServerConnectionMiddleware.cs | Removed Task.Run wrapper, directly returning the async task from InnerOnConnectionAsync |
| src/Orleans.Connections.Security/Security/TlsClientConnectionMiddleware.cs | Removed Task.Run wrapper, directly returning the async task from InnerOnConnectionAsync |
ReubenBond
enabled auto-merge
January 20, 2026 20:27
for TlsClientConnectionMiddleware and TlsServerConnectionMiddleware. This change simplifies the code and improves performance by directly returning the Task from InnerOnConnectionAsync.
rkargMsft
pushed a commit
to rkargMsft/orleans
that referenced
this pull request
Feb 27, 2026
for TlsClientConnectionMiddleware and TlsServerConnectionMiddleware. This change simplifies the code and improves performance by directly returning the Task from InnerOnConnectionAsync.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removed unnecessary Task.Run in OnConnectionAsync methods for TlsClientConnectionMiddleware and TlsServerConnectionMiddleware. This change simplifies the code and improves performance by directly returning the Task from InnerOnConnectionAsync.
Microsoft Reviewers: Open in CodeFlow