Retry other resolved addresses when a source host is partially blocked#30
Open
Zmeikich wants to merge 3 commits into
Open
Retry other resolved addresses when a source host is partially blocked#30Zmeikich wants to merge 3 commits into
Zmeikich wants to merge 3 commits into
Conversation
Some ISPs block individual CDN addresses, so requests to a source (e.g. gist.githubusercontent.com) fail or succeed depending on which of its addresses the system resolver happens to return. When a request fails to connect or times out, resolve the failing host (which may differ from the original url's host after a redirect) and retry with each address pinned in turn until one works. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
When the direct connection fails and addresses are being cycled, emit a connection_status event from the backend and show what is happening on the localizations loading screen instead of a bare spinner. Messages are translated for all supported languages. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
When the fallback finds a working address, save it to address_cache.json in the app config directory and route requests to that host through it from the start, so later launches connect immediately instead of waiting out the failing direct attempt. If a saved address stops working it is dropped and rediscovered. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Some ISPs (notably in Russia) block individual IP addresses of
*.githubusercontent.com.gist.githubusercontent.comresolves to four addresses (185.199.108.133 – 185.199.111.133),and when only some of them are blocked, the Github source fails intermittently:
Whether a request succeeds depends purely on which address the OS resolver happens to
return, so the app appears "randomly broken" for affected users. The same issue affects
localization downloads and fonts (
release-assets.githubusercontent.com,raw.githubusercontent.comshare the same address pool).Fix
request is retried with each address pinned in turn (5 s connect timeout per address)
until one works. The failing host is taken from the reqwest error, so redirect targets
(e.g.
github.com→release-assets.githubusercontent.com) are handled too.30 s request timeout.
connection_statusevent and thelocalizations loading screen shows what is happening instead of a bare spinner
("Can't connect directly, trying 185.199.111.133:443"). Messages are translated for all
supported languages.
address_cache.jsonin theapp config directory and used for subsequent requests and launches, so users on
affected networks only wait through the discovery once. If a saved address stops
working, it is dropped and rediscovered automatically.
Testing
Tested on a real network where the ISP blocks
185.199.110.133:Previously the Github source failed whenever the resolver picked the blocked address;
now the list, downloads and fonts recover ~5 s after the first failed attempt, with the
status line visible during the retry. Also verified that behavior on unaffected networks is unchanged
(
cargo checkandpnpm buildpass, no new warnings).Restarting the app after discovery connects through the saved address immediately
(
Loaded saved addressesin the log, no retry delay).