From 9b6e402837a660e4aae51c603b93d7671aca59a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Tue, 5 Nov 2024 11:54:26 -0600 Subject: [PATCH] Remove extra tasks from first request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- api/cloudcontroller/ccv3/paginate.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api/cloudcontroller/ccv3/paginate.go b/api/cloudcontroller/ccv3/paginate.go index 12c6fbca3b..d071071898 100644 --- a/api/cloudcontroller/ccv3/paginate.go +++ b/api/cloudcontroller/ccv3/paginate.go @@ -66,12 +66,22 @@ func (requester RealRequester) wrapFirstPage(request *cloudcontroller.Request, o } func (requester RealRequester) bulkRetrieval(request *cloudcontroller.Request, obj interface{}, appendToExternalList func(interface{}) error) (IncludedResources, Warnings, error) { - wrapper, warnings, err := requester.wrapFirstPage(request, obj, appendToExternalList) + wrapper, warnings, err := requester.wrapFirstPage(request, obj, func(i interface{}) error { return nil }) if err != nil { return IncludedResources{}, warnings, err } if wrapper.Pagination.Next.HREF == "" { + list, err := wrapper.Resources() + if err != nil { + return IncludedResources{}, warnings, err + } + for _, item := range list { + err = appendToExternalList(item) + if err != nil { + return IncludedResources{}, warnings, err + } + } return wrapper.IncludedResources, warnings, nil }