force-update: single-shot with a 30s fail-fast timeout

This commit is contained in:
mram
2026-09-21 09:09:27 +02:00
parent cedf28a809
commit 272a3a467d
2 changed files with 10 additions and 6 deletions
+3 -1
View File
@@ -315,7 +315,9 @@ func forceUpdateCommand(configPath string, elevatedChild bool) int {
defer logCloser.Close()
u := &update.Updater{Repo: cfg.UpdateRepo, Asset: cfg.UpdateAsset, Version: version, Log: log}
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
// Single-shot: one attempt, fail fast when the server is unreachable
// instead of hanging in a TCP connect for minutes.
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
staged, err := u.Check(ctx, exePath)
if err != nil && isPermission(err) && !service.Elevated() {