Retry version check on transient proxy failures#195
Open
jojinkb wants to merge 1 commit into
Open
Conversation
bc8dc45 to
960ab30
Compare
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.
Fixes #196
Problem
bootdev status— and the background update check that runs on every command viaversion.FetchUpdateInfo— intermittently fails with:The failure is transient (reproduces ~1 in 4 runs on my network). Instrumenting
getLatestVersionshows the real cause is a dropped connection to the Go module proxy:getLatestVersionhas no resilience to this:[proxy.golang.org, direct], butdirectis (correctly) skipped since@latestcan't be fetched from it over HTTP, soproxy.golang.orgis effectively the only source.http.Get, so a stalled connection can hang.200without aVersionfield) is indistinguishable from a real failure, and the user only ever sees the generic message.Fix
http.Clientwith a 10s timeout instead of barehttp.Get.200and reject empty-version responses.bootdev statussurfaces the real cause instead of an opaque message.No change in behavior on the happy path; the version string returned is identical.
Tests
Added
version/version_test.go(httptest-based, no network) covering:fetchLatestFromProxy: success, non-200, invalid JSON, empty versionfetchLatestWithRetry: recovery after a transient dropped connectiongo test ./...passes locally.