Skip to content

Commit

Permalink
Upgrade reports before caching
Browse files Browse the repository at this point in the history
This change will reduces upgrades, since `report.Upgrade` only performs an upgrade if necessary.
  • Loading branch information
Roberto Bruggemann committed Dec 12, 2017
1 parent 0520d0d commit e58f865
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/multitenant/aws_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ func (c *awsCollector) getReports(ctx context.Context, reportKeys []string) ([]r
log.Warningf("Error fetching from cache: %v", err)
}
for key, report := range found {
report = report.Upgrade()
c.inProcess.StoreReport(key, report)
reports = append(reports, report)
}
Expand Down Expand Up @@ -337,7 +338,7 @@ func (c *awsCollector) Report(ctx context.Context, timestamp time.Time) (report.
return report.MakeReport(), err
}

return c.merger.Merge(reports).Upgrade(), nil
return c.merger.Merge(reports), nil
}

func (c *awsCollector) HasHistoricReports() bool {
Expand Down

0 comments on commit e58f865

Please sign in to comment.