Skip to content

Commit

Permalink
Close storage objects before cleaning (#16934) (#16942)
Browse files Browse the repository at this point in the history
Backport #16934

Storage.Iterate provides the path and an open object. On windows using
local storage means that the objects will be locked thus preventing clean
from deleting them.

This PR simply closes the objects early.

Fix #16932

Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath authored Sep 3, 2021
1 parent 6f261fd commit 5cb5101
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions modules/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func Copy(dstStorage ObjectStorage, dstPath string, srcStorage ObjectStorage, sr
// Clean delete all the objects in this storage
func Clean(storage ObjectStorage) error {
return storage.IterateObjects(func(path string, obj Object) error {
_ = obj.Close()
return storage.Delete(path)
})
}
Expand Down

0 comments on commit 5cb5101

Please sign in to comment.