lib/flapjack/cli/purge.rb in flapjack-1.1.0 vs lib/flapjack/cli/purge.rb in flapjack-1.2.0rc1

- old
+ new

@@ -33,13 +33,13 @@ checks = if @options[:check] [Flapjack::Data::EntityCheck.for_event_id(@options[:check], :redis => redis, :create_entity => true)] else Flapjack::Data::EntityCheck.all(:redis => redis, :create_entity => true) end - purged = checks.map do |check| - p = check.purge_history(options) - p == 0 ? nil : p - end.compact + purged = checks.inject([]) do |memo, check| + pu = check.purge_history(options) + memo << pu unless pu == 0 + end if purged.empty? puts "Nothing to do" else puts "Purged #{purged.reduce(:+) || 0} historical check states over #{purged.length} checks."