Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
fix: bulk insert ec2 for each describe call instead of one by one (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Quigley committed Mar 18, 2021
1 parent 3636a8b commit 7080327
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions resources/ec2/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,12 @@ func (c *Client) instances(gConfig interface{}) error {
if err != nil {
return err
}
var instances []*Instance
for _, reservation := range output.Reservations {
c.log.Info("Fetched resources", "resource", "ec2.instances", "count", len(reservation.Instances))
c.db.ChunkedCreate(c.transformInstances(&reservation.Instances))
instances = append(instances, c.transformInstances(&reservation.Instances)...)
}
c.log.Info("Fetched resources", "resource", "ec2.instances", "count", len(instances))
c.db.ChunkedCreate(instances)
if aws.ToString(output.NextToken) == "" {
break
}
Expand Down

0 comments on commit 7080327

Please sign in to comment.