Commit Graph
1 Commits
Author SHA1 Message Date
yetone f3d8a09d24 providers: another vendor's base isn't parsed to look for Tencent or OpenCode Go
The Providers page asks tencentPlanRegion and openCodeGateway of every
provider on each list. Both url.Parse'd every base, a heap profile of 40
/api/providers asks put 3MB of url.Parse there (2.5MB Tencent, 0.5MB
OpenCode). Every host either takes holds "tencentmaas.com" or
"opencode.ai", so a base without it (case folded; ToLower copies nothing
for an already lower-case base) returns at once.

TestOtherVendorsBasesAreNotParsed: 0 allocations for another vendor's
provider and base, and mixed-case Tencent and OpenCode Go bases still
resolve (ap-guangzhou, go). Red on the old code (3 and 1 allocations).

Run on mote at 682a1e392: go test ./internal/provider ./internal/gui ok;
vet provider for darwin, linux and windows ok.
2026-11-10 04:33:22 +08:00