lib/spanx/actor/analyzer.rb in spanx-0.1.0 vs lib/spanx/actor/analyzer.rb in spanx-0.1.1
- old
+ new
@@ -36,29 +36,22 @@
# Look through every IP on the stack. IPs that fulfill a PeriodCheck
# are pushed onto a redis block list.
def analyze_all_ips
return unless Spanx::IPChecker.enabled?
- @previously_blocked_ips = Spanx::IPChecker.blocked_identifiers
-
+ @previously_blocked_ips = Spanx::IPChecker.rate_limited_identifiers
ips = Spanx::IPChecker.tracked_identifiers
Logger.logging "analyzed #{ips.size} IPs" do
ips.each do |ip|
- blocked_ip = analyze_ip(ip)
+ blocked_ip = Spanx::IPChecker.new(ip).analyze
blocked_ips << blocked_ip if blocked_ip
end
end
Logger.log "blocking [#{blocked_ips.size}] ips" unless blocked_ips.empty?
call_notifiers(blocked_ips)
blocked_ips.clear
- end
-
- # Analyze individual IP for all defined periods. As soon as one
- # rule is triggered, exit the method
- def analyze_ip(ip)
- Spanx::IPChecker.new(ip).analyze
end
private
def initialize_notifiers(config)