Skip to content

Removed unnecessary Task.Run in OnConnectionAsync methods - #9650

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
desdesdes:tls-improve
Feb 15, 2026
Merged

ReubenBond merged 1 commit into
dotnet:mainfrom
desdesdes:tls-improve

Conversation

@desdesdes

@desdesdes desdesdes commented Aug 20, 2025 •

Copy link
Copy Markdown
Contributor

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

@desdesdes

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree company="AFAS Software"

Copilot AI review requested due to automatic review settings January 20, 2026 20:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 OnConnectionAsync to directly return InnerOnConnectionAsync(context) in TlsServerConnectionMiddleware
  • Simplified OnConnectionAsync to directly return InnerOnConnectionAsync(context) in TlsClientConnectionMiddleware

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
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.
@ReubenBond
ReubenBond added this pull request to the merge queue Feb 15, 2026
Merged via the queue into dotnet:main with commit 87cfa0a Feb 15, 2026
59 checks passed
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.
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants