chore: make horizon depend on instance

This commit is contained in:
andig 2026-04-21 16:17:26 +02:00
parent 00216f46af
commit ab1c0202fb

View file

@ -120,8 +120,11 @@ func (site *Site) optimizerUpdate(battery []types.Measurement) error {
minLen = min(minLen, len(solar))
}
// limit to 2 days for sake of performance
minLen = min(2*96, minLen)
uri := os.Getenv("OPTIMIZER_URI")
if uri == "" {
uri = OPTIMIZER_URI
minLen = min(2*96, minLen) // limit to 2 days for sake of performance
}
if expectedSlots := 8; minLen < expectedSlots {
if solarTariff != nil {
@ -229,7 +232,6 @@ func (site *Site) optimizerUpdate(battery []types.Measurement) error {
httpClient := request.NewClient(site.log)
httpClient.Timeout = 30 * time.Second
uri := lo.CoalesceOrEmpty(os.Getenv("OPTIMIZER_URI"), OPTIMIZER_URI)
apiClient, err := optimizer.NewClientWithResponses(uri, optimizer.WithHTTPClient(httpClient))
if err != nil {
return err