Skip to content

Commit

Permalink
fix: add logging to cache cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
msvticket committed Sep 20, 2023
1 parent 681630e commit 8015896
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/fs_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func (fs *FileSystemStorage) WriteFile(path string, file io.ReadCloser) error {

// RemoveUnusedArtifacts cleans away artifacts that have not been used for configurable amount of time
func (fs *FileSystemStorage) RemoveUnusedArtifacts(ctrl *FileController) {
logrus.Info("starting removal of unused artifacts")
cacheTime := fs.config.CacheTime
maxAccessTime := time.Now().Add(-cacheTime)
var err error
Expand All @@ -70,6 +71,7 @@ func (fs *FileSystemStorage) RemoveUnusedArtifacts(ctrl *FileController) {
}
aTime := atime.Get(info)
if aTime.Before(maxAccessTime) {
logrus.Debugf("removing %s that has not been accessed since %s", path, aTime)
err := os.RemoveAll(path)
if err != nil {
return err
Expand Down

0 comments on commit 8015896

Please sign in to comment.