Skip to content

Commit

Permalink
Use a more effective method of counting
Browse files Browse the repository at this point in the history
This saves an intermediate array.
  • Loading branch information
ekohl committed Oct 25, 2024
1 parent 07f3b0c commit 5ff7a96
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion files/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def metrics_to_hash(report)
report_status["failed"] += 1
end
# fix for Puppet non-resource errors (i.e. failed catalog fetches before falling back to cache)
report_status["failed"] += report.logs.find_all {|l| l.source =~ /Puppet$/ && l.level.to_s == 'err' }.count
report_status["failed"] += report.logs.count {|l| l.source =~ /Puppet$/ && l.level.to_s == 'err' }

return report_status
end
Expand Down

0 comments on commit 5ff7a96

Please sign in to comment.