Skip to content

Commit

Permalink
feat: only write data to file if cache got updated
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Gleich <[email protected]>
  • Loading branch information
gleich committed Jul 27, 2024
1 parent 74a6ebf commit d4d7709
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ func (c *Cache[T]) Update(data T) {
updated = true
}
c.mutex.Unlock()
c.updateCounter.Inc()
metrics.CacheUpdates.Inc()
c.writeToFile()
if updated {
c.updateCounter.Inc()
metrics.CacheUpdates.Inc()
c.writeToFile()
lumber.Success(c.Name, "updated")
}
}
Expand Down

0 comments on commit d4d7709

Please sign in to comment.