lib/flapjack/data/entity.rb in flapjack-0.7.18 vs lib/flapjack/data/entity.rb in flapjack-0.7.19
- old
+ new
@@ -95,16 +95,16 @@
}.sort
end
def self.find_all_with_checks(options)
raise "Redis connection not set" unless redis = options[:redis]
- redis.keys("check:*").map {|s| s.sub(/^check:/, '').split(':', 2).first }.to_set
+ redis.zrange("current_entities", 0, -1)
end
def self.find_all_with_failing_checks(options)
raise "Redis connection not set" unless redis = options[:redis]
- redis.zrange("failed_checks", 0, -1).map {|s| s.split(':', 2).first }.to_set
+ Flapjack::Data::EntityCheck.find_all_failing_by_entity(:redis => redis).keys
end
def contacts
contact_ids = @redis.smembers("contacts_for:#{id}")
@@ -117,10 +117,10 @@
Flapjack::Data::Contact.find_by_id(c_id, :redis => @redis)
}.compact
end
def check_list
- @redis.keys("check:#{@name}:*").map {|k| k =~ /^check:#{@name}:(.+)$/; $1}
+ @redis.zrange("current_checks:#{@name}", 0, -1)
end
def check_count
checks = check_list
return if checks.nil?