Skip to content

Commit

Permalink
add storage size log before cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Bertschy <[email protected]>
  • Loading branch information
matthyx committed Aug 20, 2024
1 parent da419af commit 7834c1a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/cleanup/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func (h *ResourcesCleanupHandler) StartCleanupTask() {
continue
}

var size int64
for resourceKind, handler := range resourceKindToHandler {
v1beta1ApiVersionPath := filepath.Join(h.root, softwarecomposition.GroupName, resourceKind)
exists, _ := afero.DirExists(h.appFs, v1beta1ApiVersionPath)
Expand All @@ -87,6 +88,11 @@ func (h *ResourcesCleanupHandler) StartCleanupTask() {
return err
}

// sum all files in path
if !info.IsDir() {
size += info.Size()
}

// FIXME: migrate to gob files - to remove after some time
if strings.HasSuffix(path, file.JsonExt) {
switch resourceKind {
Expand Down Expand Up @@ -151,6 +157,8 @@ func (h *ResourcesCleanupHandler) StartCleanupTask() {
}
}

logger.L().Info("storage size before cleanup", helpers.String("path", h.root), helpers.String("size", fmt.Sprintf("%d bytes", size)))

if h.interval == 0 {
break
}
Expand Down

0 comments on commit 7834c1a

Please sign in to comment.