Skip to content

Commit

Permalink
Merge pull request #1342 from nalind/wipe-order
Browse files Browse the repository at this point in the history
layers.Wipe(): try to remove layers before their parents
  • Loading branch information
giuseppe committed Sep 14, 2022
2 parents ddf0d3d + 627c202 commit 631b9cb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions layers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1388,6 +1388,9 @@ func (r *layerStore) Wipe() error {
for id := range r.byid {
ids = append(ids, id)
}
sort.Slice(ids, func(i, j int) bool {
return r.byid[ids[i]].Created.After(r.byid[ids[j]].Created)
})
for _, id := range ids {
if err := r.Delete(id); err != nil {
return err
Expand Down

0 comments on commit 631b9cb

Please sign in to comment.