mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-16 12:08:04 +00:00
s3: clear / invalidate pathCache for repeated operations
This commit is contained in:
+7
-1
@@ -228,11 +228,13 @@ func (storage *PublishedStorage) Remove(path string) error {
|
|||||||
return errors.Wrap(err, fmt.Sprintf("error deleting %s from %s", path, storage))
|
return errors.Wrap(err, fmt.Sprintf("error deleting %s from %s", path, storage))
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(storage.pathCache, path)
|
|
||||||
if storage.plusWorkaround && strings.Contains(path, "+") {
|
if storage.plusWorkaround && strings.Contains(path, "+") {
|
||||||
// try to remove workaround version, but don't care about result
|
// try to remove workaround version, but don't care about result
|
||||||
_ = storage.Remove(strings.Replace(path, "+", " ", -1))
|
_ = storage.Remove(strings.Replace(path, "+", " ", -1))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete(storage.pathCache, path)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,6 +261,7 @@ func (storage *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error deleting path %s from %s: %s", filelist[i], storage, err)
|
return fmt.Errorf("error deleting path %s from %s: %s", filelist[i], storage, err)
|
||||||
}
|
}
|
||||||
|
delete(storage.pathCache, filepath.Join(path, filelist[i]))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
numParts := (len(filelist) + page - 1) / page
|
numParts := (len(filelist) + page - 1) / page
|
||||||
@@ -290,6 +293,9 @@ func (storage *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error deleting multiple paths from %s: %s", storage, err)
|
return fmt.Errorf("error deleting multiple paths from %s: %s", storage, err)
|
||||||
}
|
}
|
||||||
|
for i := range part {
|
||||||
|
delete(storage.pathCache, filepath.Join(path, part[i]))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user