Skip to content

Commit

Permalink
break on error
Browse files Browse the repository at this point in the history
  • Loading branch information
akavatl committed Nov 6, 2024
1 parent 3b85ccf commit aa859af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/cloudproviders/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ func (p *Provider) Instance(ctx context.Context, IP ...gostatsd.Source) (map[gos
}

page, rawErr := p.Ec2.DescribeInstances(ctx, input)
nextToken = *page.NextToken
if rawErr != nil {
atomic.AddUint64(&p.describeInstanceErrors, 1)
hasPagesRemaining = false

if rawErr.Error() != "InvalidInstanceID.NotFound" {
err = fmt.Errorf("error listing AWS instances: %v", rawErr)
}
break
}
for _, reservation := range page.Reservations {
for _, instance := range reservation.Instances {
Expand Down Expand Up @@ -145,7 +145,7 @@ func (p *Provider) Instance(ctx context.Context, IP ...gostatsd.Source) (map[gos
}).Debug("Added tags")
}
}

nextToken = *page.NextToken
hasPagesRemaining = page.NextToken != nil && *page.NextToken != ""
}

Expand Down

0 comments on commit aa859af

Please sign in to comment.