-
Notifications
You must be signed in to change notification settings - Fork 556
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
Use /mirrors/status/json/
instead of /mirrorlist/
to get mirror lists
#2599
Conversation
…the JSON endpoint is cached and easier to parse
This is great, wgen doing the migration to the new menu I was wondering why the mirror menu takes so long to open |
…the mirrors 'score' rather than just the URL name. This will emulate the reflector.service/rankmirrors behavior and thus reducing the need to re-rank the mirrors.
Yeah it's a bit faster, and also we get more useful data from this. I'm currently sorting the mirrors based on Edit: Also need to fix the flake8/mypy obviously heh |
I will have to tinker a bit. So we have to adopt:
This should give us a speedy UI since ping is pretty fast. And if the user opt-out and just use what |
… sorted(mirror_list, key=lambda mirror: (mirror.score, mirror.speed)) - but I have not implemented the sorting via the menu yet, and I have not integrated the new MirrorStatus model into the handling of URL's. I still need to figure out where the {region: [url, url]} is being used, so that i can convert to {region: [mirror.url, mirror.url]} logic.
…g to mirrorlist
Can't recall if there was a purpose behind doing So I made a small change to #2350 which is |
…format, only the base location for the mirror. So we have to adjust for this.
…r, had to change to 'after' instead.
I think I'm satisfied, comments would be welcome. The reason why the fastest mirror isn't at the top, is because |
@property | ||
def speed(self): | ||
if self._speed is None: | ||
info(f"Checking download speed of {self._hostname}[{self.score}] by fetching: {self.url}core/os/x86_64/core.db") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
info
won't be shown to the user, so maybe just use debug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Description:
This is more of a performance tweak, as the
/json/
endpoint is cached in the backend and machine readable, whereas the ASCII human version of mirror status is not.pydantic
as a dependencyreflector.service
behavior after mirror selection (Sort order:score
->download speed
)ping()
function. We're currently not usingmirror.latency
but there's a possibility we could in the future if we wanted to.Future improvements could be that we could use
pacman-mirrorlist
package as source, convert that to JSON that we could consume, solving potential issues such as #2598.Tests and Checks