Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions actor/v7action/resource_match.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ func (actor Actor) ResourceMatch(resources []sharedaction.V3Resource) ([]shareda
)

for _, chunk := range resourceChunks {
newMatchedAPIResources, warnings, err := actor.CloudControllerClient.ResourceMatch(chunk)
allWarnings = append(allWarnings, warnings...)
if err != nil {
return nil, allWarnings, err
if len(chunk) > 0 {
newMatchedAPIResources, warnings, err := actor.CloudControllerClient.ResourceMatch(chunk)
allWarnings = append(allWarnings, warnings...)
if err != nil {
return nil, allWarnings, err
}
matchedAPIResources = append(matchedAPIResources, newMatchedAPIResources...)
}
matchedAPIResources = append(matchedAPIResources, newMatchedAPIResources...)
}

var matchedResources []sharedaction.V3Resource
Expand All @@ -51,8 +53,10 @@ func (Actor) chunkResources(resources []sharedaction.V3Resource) [][]ccv3.Resour
}

if len(currentSet) == constant.MaxNumberOfResourcesForMatching || index+1 == len(resources) {
chunkedResources = append(chunkedResources, currentSet)
currentSet = []ccv3.Resource{}
if len(currentSet) > 0 {
chunkedResources = append(chunkedResources, currentSet)
currentSet = []ccv3.Resource{}
}
}
}
return chunkedResources
Expand Down
Loading