Skip to content

bug: FetchLatestVersion uses bare http.Get with no timeout — can hang TUI startup #58

@ali5ter

Description

@ali5ter

Summary

api/client.go:FetchLatestVersion uses the default http.Get:

func FetchLatestVersion() string {
    resp, err := http.Get("https://api.github.com/repos/ali5ter/wwlog/releases/latest")

http.Get uses the default client, which has no timeout. In practice this means:

  • Slow or unreachable network (airplane mode, captive portals, corporate proxies) can stall the TUI for 30-90 seconds.
  • The version check is fired as a background Bubble Tea command on every TUI launch — a connection that never returns will keep that goroutine open for the lifetime of the process.

Why it matters

The version check is entirely optional UX. A hang here degrades startup for every user on a slow or offline network.

Suggested approach

Use a short-lived client with an aggressive timeout (2–3 seconds):

client := &http.Client{Timeout: 3 * time.Second}
resp, err := client.Get("https://api.github.com/repos/ali5ter/wwlog/releases/latest")

That matches the spirit of "returns empty string on any error" while bounding the worst-case wait.

🤖 Generated with Claude Code on behalf of Alister

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions