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

Fallback strategy if fetching data from remote JSON endpoint has failed #36

Closed
nroi opened this issue Dec 20, 2020 · 0 comments
Closed
Labels
enhancement New feature or request

Comments

@nroi
Copy link
Owner

nroi commented Dec 20, 2020

When Flexo starts and the latency results are not available yet or obsolete, it fetches the JSON document from https://archlinux.org/mirrors/status/json/ and deserializes the JSON content. There are various reasons why this can fail:

  • The ArchLinux server can be offline for maintenance.
  • The URL could have changed (in fact, this has already happened in the past).
  • The JSON format could have changed, for example, a field that used to be included in the past might have been removed.

To make Flexo more robust, we should include a fallback strategy to cope with this. Current plan:

  • Include a new setting such as mirrors_auto.mirrors_status_json_endpoint_fallback.
  • By default, this setting is set to something like file:///var/cache/flexo/state/mirrorlist_fallback.json (the nice thing is that we use CURL to fetch the JSON, and CURL understands file:// just as well as it does https://.
  • Flexo updates this file (/var/cache/flexo/state/mirrorlist_fallback.json) as soon as it has successfully fetched, and deserialized, the mirrors from the remote endpoint. Make sure that the existing file is overwritten only after the deserialization has succeeded!
  • When Flexo starts, and it has failed to fetch and deserialize the content from https://archlinux.org/mirrors/status/json/, then it will fetch the JSON from the fallback file.
@nroi nroi added the enhancement New feature or request label Dec 20, 2020
nroi added a commit that referenced this issue Aug 3, 2021
@nroi nroi closed this as completed Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant