Skip to content

Commit

Permalink
Remove extra tasks from first request
Browse files Browse the repository at this point in the history
Signed-off-by: João Pereira <[email protected]>
  • Loading branch information
joaopapereira committed Nov 5, 2024
1 parent 5e2ca9b commit 9b6e402
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion api/cloudcontroller/ccv3/paginate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 9b6e402

Please sign in to comment.