Skip to content

Commit

Permalink
set default value of 5GB for cache size it is zero (#2129)
Browse files Browse the repository at this point in the history
* set default value of 5GB for cache size it is zero

* set a limit size to the cache volume

* wrap the error
  • Loading branch information
Omarabdul3ziz authored Nov 22, 2023
1 parent 6ad839b commit cbdd1b0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,13 @@ func (s *Module) checkAndResizeCache(cache filesystem.Volume, sizeMultiplier uin
if err != nil {
return errors.Wrap(err, "failed to check cache usage")
}
if usage.Size == 0 {
usage.Size = max(sizeMultiplier, usage.Excl*2)
if err := cache.Limit(usage.Size); err != nil {
return errors.Wrap(err, "failed to set limit for cache volume")
}
}

log.Debug().Msgf("cache usage %+v", usage)
percent := usage.Excl * 100 / usage.Size
size := usage.Size
Expand Down

0 comments on commit cbdd1b0

Please sign in to comment.