diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-08 07:14:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-08 07:14:37 -0400 |
commit | 3173a18f6f97ddb684230296054216b526a54f0e (patch) | |
tree | a75b3cb153d308097c97470aa0958929cab88c22 /pkg/api/handlers/utils/images.go | |
parent | 1298161ae47a77ba2666903a30ae080710b00f9c (diff) | |
parent | 8827100b98d0e8afa6cd7a8d7415cb748948a417 (diff) | |
download | podman-3173a18f6f97ddb684230296054216b526a54f0e.tar.gz podman-3173a18f6f97ddb684230296054216b526a54f0e.tar.bz2 podman-3173a18f6f97ddb684230296054216b526a54f0e.zip |
Merge pull request #7215 from vrothberg/flatten-the-curve
images: speed up lists
Diffstat (limited to 'pkg/api/handlers/utils/images.go')
-rw-r--r-- | pkg/api/handlers/utils/images.go | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/pkg/api/handlers/utils/images.go b/pkg/api/handlers/utils/images.go index 28b1dda38..aad00c93b 100644 --- a/pkg/api/handlers/utils/images.go +++ b/pkg/api/handlers/utils/images.go @@ -102,20 +102,14 @@ func GetImages(w http.ResponseWriter, r *http.Request) ([]*image.Image, error) { if query.All { return images, nil } - returnImages := []*image.Image{} - for _, img := range images { - if len(img.Names()) == 0 { - parent, err := img.IsParent(r.Context()) - if err != nil { - return nil, err - } - if parent { - continue - } - } - returnImages = append(returnImages, img) + + filter, err := runtime.ImageRuntime().IntermediateFilter(r.Context(), images) + if err != nil { + return nil, err } - return returnImages, nil + images = image.FilterImages(images, []image.ResultFilter{filter}) + + return images, nil } func GetImage(r *http.Request, name string) (*image.Image, error) { |