Fix for servers being returned that are less performant than the closest #23
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.
This PR rewrites the
Closest
function to add aMaxDeviation
field, which allows a configurable maximum distance from the closest server to be used. This will prevent issues when there's a close (<50km) server, and then the next two closest are 500km away.Changes
maxDeviation
in yaml) which defaults to 50kmlocalServer
checks which could cause issues with countries that only have one server, or servers that are nowhere near the user. For example, if a server is in Vancouver, BC in Canada, and a user from Toronto wants to get a mirror, it would prefer and return the Vancouver mirror instead of a closer Chicago or New York one. This is resolved by using one server and the MaxDeviation fields.