Skip to content

Commit

Permalink
Remove unnecessary for cycle
Browse files Browse the repository at this point in the history
Signed-off-by: constanca <[email protected]>
  • Loading branch information
constanca-m committed Mar 18, 2024
1 parent 7f95a32 commit 9e93b11
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions x-pack/metricbeat/module/azure/monitor_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,15 @@ func (service *MonitorService) GetMetricDefinitionsWithRetry(resourceId string,
metricDefinitionCollection := armmonitor.MetricDefinitionCollection{}

for pager.More() {

for {
nextPage, err := pager.NextPage(service.context)
if err != nil {
retryError := service.sleepIfPossible(err, resourceId, namespace)
if retryError != nil {
return armmonitor.MetricDefinitionCollection{}, err
}
} else {
metricDefinitionCollection.Value = append(metricDefinitionCollection.Value, nextPage.Value...)
break
nextPage, err := pager.NextPage(service.context)
if err != nil {
retryError := service.sleepIfPossible(err, resourceId, namespace)
if retryError != nil {
return armmonitor.MetricDefinitionCollection{}, err
}
continue
}
metricDefinitionCollection.Value = append(metricDefinitionCollection.Value, nextPage.Value...)
}

return metricDefinitionCollection, nil
Expand Down

0 comments on commit 9e93b11

Please sign in to comment.