From 59cb75974dd7e4b4845f501f79a7db6172ba17fe Mon Sep 17 00:00:00 2001 From: andig Date: Wed, 20 Aug 2025 19:14:49 +0200 Subject: [PATCH] Tariff: fix caching templates (#23131) --- tariff/proxy.go | 4 ++-- tariff/template.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tariff/proxy.go b/tariff/proxy.go index 661aea45f..2caba2b46 100644 --- a/tariff/proxy.go +++ b/tariff/proxy.go @@ -45,7 +45,7 @@ func NewCachedFromConfig(ctx context.Context, typ string, other map[string]any) } if !slices.Contains(embed.Features, api.Cacheable) { - return NewFromConfig(ctx, typ, other) + return NewFromConfig(ctx, typ, embed.Other) } p := &CachingProxy{ @@ -59,7 +59,7 @@ func NewCachedFromConfig(ctx context.Context, typ string, other map[string]any) data, err := p.cacheGet(untilEndOfTomorrow()) if err != nil { // attempt to create a new instance - tariff, err := NewFromConfig(ctx, typ, other) + tariff, err := NewFromConfig(ctx, typ, embed.Other) if err != nil { // check if we have at least data for the next 24 hours atLeast2hrs, err2 := p.cacheGet(for24hrs()) diff --git a/tariff/template.go b/tariff/template.go index bf9a44548..2c9ad18f4 100644 --- a/tariff/template.go +++ b/tariff/template.go @@ -17,5 +17,5 @@ func NewTariffFromTemplateConfig(ctx context.Context, other map[string]interface return nil, err } - return NewFromConfig(ctx, instance.Type, instance.Other) + return NewCachedFromConfig(ctx, instance.Type, instance.Other) }