Skip to content

Commit 4527842

Browse files
authored
Merge pull request ActiveState#3667 from ActiveState/mitchell/dx-3213
When deleting cached depot artifacts, ensure ID is set.
2 parents 59dad38 + 58185b2 commit 4527842

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/runtime/depot.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,12 @@ func (d *depot) removeStaleArtifacts() error {
485485
var totalSize int64
486486
unusedArtifacts := make([]*artifactInfo, 0)
487487

488-
for _, info := range d.config.Cache {
488+
for id, info := range d.config.Cache {
489489
if !info.InUse {
490490
totalSize += info.Size
491-
unusedArtifacts = append(unusedArtifacts, info)
491+
unusedInfo := *info
492+
unusedInfo.id = id // id is not set in cache since info is keyed by id
493+
unusedArtifacts = append(unusedArtifacts, &unusedInfo)
492494
}
493495
}
494496
logging.Debug("There are %d unused artifacts totaling %.1f MB in size", len(unusedArtifacts), float64(totalSize)/float64(MB))

0 commit comments

Comments
 (0)