force-update: single-shot with a 30s fail-fast timeout
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user