kiwix, weather: name the client timeout constant (V-581)

Both clients used a bare 10*time.Second literal for the http.Client
timeout, unlike websearch.DefaultTimeout which carries a comment
explaining the number. Naming them puts the reason (LAN ZIM read vs.
a public API over the internet) next to the value; the constants
equal what was there before, so behaviour is unchanged.
This commit is contained in:
2026-08-06 02:41:45 +04:00
parent c0aee1558f
commit dd6da78aeb
2 changed files with 13 additions and 2 deletions
+7 -1
View File
@@ -13,13 +13,19 @@ import (
"github.com/kami/maven/internal/morph"
)
// clientTimeout — the whole request, geocode or forecast. Both are one call to
// a public API over the internet rather than a LAN service, hence longer than
// a bare "it's slow" budget; there is no retry behind it, so a slow reply
// still costs the caller the whole wait.
const clientTimeout = 10 * time.Second
type OpenMeteoProvider struct {
httpClient *http.Client
}
func NewOpenMeteoProvider() *OpenMeteoProvider {
return &OpenMeteoProvider{
httpClient: &http.Client{Timeout: 10 * time.Second},
httpClient: &http.Client{Timeout: clientTimeout},
}
}