From 824ed920ff06218cb2200f81fb9a34103b9e422f Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Sat, 16 May 2026 11:41:51 +0200 Subject: [PATCH] fix(cli): give wifi-push the time the speaker needs to ACK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The speaker confirms AddWirelessProfile then tears down its AP within ~30 s. The default 10 s --request-timeout races that ACK whenever the speaker is busy reconciling state — and a hard-coded 10 s on the internal http.Client capped the user-passed timeout silently, so a longer --request-timeout had no effect. The CLI default is now 30 s and the inner http.Client lets the context govern alone. Co-Authored-By: Claude Opus 4.7 (1M context) --- cmd/soundtouch-cli/cmd_setup.go | 2 +- pkg/service/setup/wifi_provision.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/soundtouch-cli/cmd_setup.go b/cmd/soundtouch-cli/cmd_setup.go index 96c2fa1..d543f0e 100644 --- a/cmd/soundtouch-cli/cmd_setup.go +++ b/cmd/soundtouch-cli/cmd_setup.go @@ -404,7 +404,7 @@ func setupWiFiPushCmd() *cli.Command { &cli.StringFlag{Name: "pass", Required: true, Usage: "Home Wi-Fi password"}, &cli.StringFlag{Name: "security", Value: setup.DefaultWiFiSecurity, Usage: "Security type (wpa_or_wpa2, wep, open)"}, &cli.StringFlag{Name: "ap-host", Value: setup.SpeakerSetupAP, Usage: "Speaker's setup-mode IP"}, - &cli.DurationFlag{Name: "request-timeout", Value: 10 * time.Second}, + &cli.DurationFlag{Name: "request-timeout", Value: 30 * time.Second, Usage: "Per-request timeout (the speaker can be slow to ACK before tearing down AP mode; 10 s often races)"}, }, Action: func(c *cli.Context) error { params := setup.PushWiFiCredentialsParams{ diff --git a/pkg/service/setup/wifi_provision.go b/pkg/service/setup/wifi_provision.go index 1b9202f..1c44fd2 100644 --- a/pkg/service/setup/wifi_provision.go +++ b/pkg/service/setup/wifi_provision.go @@ -78,7 +78,11 @@ func PushWiFiCredentials(ctx context.Context, p PushWiFiCredentialsParams) error httpClient := p.HTTPClient if httpClient == nil { - httpClient = &http.Client{Timeout: 10 * time.Second} + // No client-side timeout: let the caller's context govern. + // The CLI passes a context deadline (default 30 s in + // setupWiFiPushCmd) and a hard-coded 10 s here would race + // it for no benefit. + httpClient = &http.Client{} } resp, err := httpClient.Do(req)