fix(cli): give wifi-push the time the speaker needs to ACK

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) <noreply@anthropic.com>
This commit is contained in:
Tobias Gesellchen
2026-05-16 12:14:18 +02:00
co-authored by Claude Opus 4.7
parent c5938b8e05
commit 824ed920ff
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -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{
+5 -1
View File
@@ -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)