ax(mining): rename cb to circuitBreaker in FetchLatestGitHubVersion
Some checks failed
Security Scan / security (push) Failing after 23s
Test / test (push) Failing after 6m57s

AX Principle 1 — predictable names over short names. The local variable
`cb` requires mental mapping; `circuitBreaker` names the value directly.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 14:38:03 +01:00
parent dc2f415fc2
commit 1edbd19f25
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -36,16 +36,16 @@ type GitHubRelease struct {
// tag, err := FetchLatestGitHubVersion("xmrig", "xmrig") // "v6.21.0"
func FetchLatestGitHubVersion(owner, repo string) (string, error) {
cb := getGitHubCircuitBreaker()
circuitBreaker := getGitHubCircuitBreaker()
result, err := cb.Execute(func() (interface{}, error) {
result, err := circuitBreaker.Execute(func() (interface{}, error) {
return fetchGitHubVersionDirect(owner, repo)
})
if err != nil {
// If circuit is open, try to return cached value with warning
if err == ErrCircuitOpen {
if cached, ok := cb.GetCached(); ok {
if cached, ok := circuitBreaker.GetCached(); ok {
if tagName, ok := cached.(string); ok {
return tagName, nil
}