diff --git a/internal/cache/cache.go b/internal/cache/cache.go index 0b7e852..761e589 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -85,7 +85,7 @@ func (c *Cache[T]) Update(data T) { lumber.Error(err, "failed to json marshal new data") return } - if string(old) != string(new) && string(new) != "null" { + if string(old) != string(new) && string(new) != "null" && strings.Trim(string(new), " ") != "" { c.data = data c.updated = time.Now() updated = true @@ -104,8 +104,12 @@ func (c *Cache[T]) StartPeriodicUpdate(updateFunc func() (T, error), interval ti defer ticker.Stop() for range ticker.C { data, err := updateFunc() - if err != nil && !errors.Is(err, apis.WarningError) { - lumber.Error(err, "updating", c.name, "cache failed") + if err != nil { + if errors.Is(err, apis.WarningError) { + lumber.Warning(err, "updating", c.name, "cache failed") + } else { + lumber.Error(err, "updating", c.name, "cache failed") + } continue } c.Update(data)