Tariffs: add caching (#22446)

Inspired by @terrorobe
This commit is contained in:
andig 2025-07-19 23:09:05 +02:00 • committed by GitHub
parent 0bbd39333c
commit 75dad99895
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 215 additions and 1 deletions

View file

@ -805,7 +805,7 @@ func tariffInstance(name string, conf config.Typed) (api.Tariff, error) {
return nil, fmt.Errorf("cannot decode custom tariff '%s': %w", name, err)
}
instance, err := tariff.NewFromConfig(ctx, conf.Type, props)
instance, err := tariff.NewCachedFromConfig(ctx, conf.Type, props)
if err != nil {
if ce := new(util.ConfigError); errors.As(err, &ce) {
return nil, err