Skip to content

Commit

Permalink
feat: only write data once
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 8a501c8 commit eea32da
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func New[T any](name string, data T) *Cache[T] {
}
cache.seedFromFile()
cache.Update(data)
cache.writeToFile()
return &cache
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (c *Cache[T]) writeToFile() {
return
}
} else {
file, err = os.OpenFile(c.filePath, os.O_WRONLY|os.O_TRUNC, 0600)
file, err = os.OpenFile(c.filePath, os.O_WRONLY|os.O_TRUNC, 0666)
if err != nil {
lumber.Error(err, "failed to read file at path:", c.filePath)
return
Expand Down

0 comments on commit eea32da

Please sign in to comment.