Skip to content

perf: reuse http client to prevent TLS handshake on every check - #144

Merged
OutdatedGuy merged 1 commit into
mainfrom
perf/reuse-client
Jul 1, 2026
Merged

perf: reuse http client to prevent TLS handshake on every check#144
OutdatedGuy merged 1 commit into
mainfrom
perf/reuse-client

Conversation

@OutdatedGuy

Copy link
Copy Markdown
Owner

No description provided.

@OutdatedGuy OutdatedGuy self-assigned this Jun 29, 2026
@OutdatedGuy OutdatedGuy added the performance Performance improvements label Jun 29, 2026
@OutdatedGuy
OutdatedGuy requested a review from Copilot July 1, 2026 13:10

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 aims to improve connectivity-check performance by reusing a single HTTP client instance within InternetConnection, avoiding per-check client creation and associated connection/TLS setup overhead.

Changes:

  • Add a reusable http.Client as a private field on InternetConnection.
  • Route reachability checks through the reusable client instead of http.head(...).
  • Close the reusable client during dispose().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/src/internet_connection.dart
Comment thread lib/src/internet_connection.dart

@OutdatedGuy OutdatedGuy left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

LGTM!

@OutdatedGuy
OutdatedGuy merged commit 95afc26 into main Jul 1, 2026
4 checks passed
@OutdatedGuy
OutdatedGuy deleted the perf/reuse-client branch July 1, 2026 13:25
@OutdatedGuy OutdatedGuy mentioned this pull request Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants