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

Speed up host provider auto-detection and make more robust #481

Merged
merged 2 commits into from
Oct 8, 2021

Conversation

mjcheetham
Copy link
Collaborator

@mjcheetham mjcheetham commented Oct 7, 2021

Speed up the auto-detection mechanism in the HostProviderRegistry by setting a short(er) timeout on the probing network call (2 seconds). The default value from the framework is otherwise 100 seconds(!).

We introduce a setting for the user to be able to configure this timeout value with the granularity of 1 millisecond.

Another problem that occurred with this network call was crashes due to TLS configuration issues. The network call was not wrapped in a try-catch block which meant that the entire process would crash if there was a problem. This isn't ideal for what is supposed to be a "best effort" feature. Here we wrap the HEAD call in a try-catch and display
an appropriate warning message to the user.

For completeness, add documentation that explains the auto-detection feature, how to configure the timeout, and how to disable this network call.

Fixes #384

Speed up HTTP HEAD calls made via the HeadAsync extension method by only
waiting until the headers have been received, rather than the entire
message content.
@mjcheetham mjcheetham force-pushed the autov2 branch 3 times, most recently from dc4f444 to 18aa081 Compare October 7, 2021 15:41
@mjcheetham mjcheetham marked this pull request as ready for review October 7, 2021 15:43
@mjcheetham mjcheetham added auth-issue An issue authenticating to a host enhancement New feature or request network Related to networking (VPN, TCP/IP, etc) labels Oct 7, 2021
Copy link
Contributor

@vtbassmatt vtbassmatt left a comment

Choose a reason for hiding this comment

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

👍

docs/autodetect.md Outdated Show resolved Hide resolved
Speed up the auto-detection mechanism in the HostProviderRegistry by
setting a short(er) timeout on the probing network call (2 seconds).
The default value from the framework is otherwise 100 seconds(!).

We introduce a setting for the user to be able to configure this timeout
value with the granularity of 1 millisecond.

Another problem that occured with this network call was crashes due to
TLS configuration issues. The network call was not wrapped in a
try-catch block which meant that the entire process would crash if there
was a problem. This isn't ideal for what is supposed to be a "best
effort" feature. Here we wrap the HEAD call in a try-catch and display
an appropriate warning message to the user.

For completeness, add documentation that explains the auto-detection
feature, how to configure the timeout, and how to disable this network
call.
Copy link
Contributor

@derrickstolee derrickstolee left a comment

Choose a reason for hiding this comment

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

Implementation and tests look good to me. Thanks.

@mjcheetham mjcheetham merged commit 1f926e4 into git-ecosystem:main Oct 8, 2021
@mjcheetham mjcheetham deleted the autov2 branch October 8, 2021 15:20
@mjcheetham mjcheetham mentioned this pull request Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth-issue An issue authenticating to a host enhancement New feature or request network Related to networking (VPN, TCP/IP, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve auto-detection to avoid long web request timeouts
3 participants