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

loadbalancer: Simplify ConnectionFactory usage in DefaultHost #2796

Conversation

bryce-anderson
Copy link
Contributor

Motivation:

We currently use the ConnectionFactory in two places in DefaultHost:

  • creating new connections
  • health checking

Each of them has to go through the trouble of trying to add the newly
created connection to the connection pool and making sure the state
remains coherent.

Modifications:

DefaultHosts health checking feature now uses the Host.newConnection
method instead of using the factory directly.

Results:

Using the Host.newConnection(..) method lets us reuse the connection
management properties already in DefaultHost.newConnection. It also
makes the path to extracting the health check from DefaultHost a bit
easier to envision.

Motivation:

We currently use the ConnectionFactory in two places in DefaultHost:
- creating new connections
- health checking
Each of them has to go through the trouble of trying to add the
newly created connection to the connection pool and making
sure the state remains coherent.

Modifications:

DefaultHosts health checking feature now uses the `Host.newConnection`
method instead of using the factory directly. This lets it
get the connection management benefit already in
`DefaultHost.newConnection`. It also makes the path to extracting
the health check a bit easier to follow.

Result:

What is the result of this change?
@bryce-anderson bryce-anderson merged commit aac806c into apple:main Jan 11, 2024
15 checks passed
@bryce-anderson bryce-anderson deleted the bl_anderson/DefaultHost_connectionFactoryUsage branch January 11, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants