Enrich coverage for IpBlock model (#32471)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2024-10-25 08:35:07 +00:00
1 parent 15f6336cdd
commit 66c0471515
1 file changed
+6 -1
+6 -1
View File
@@ -36,9 +36,14 @@ class IpBlock < ApplicationRecord
class << self
def blocked?(remote_ip)
blocked_ips_map = Rails.cache.fetch(CACHE_KEY) { FastIpMap.new(IpBlock.where(severity: :no_access).pluck(:ip)) }
blocked_ips_map.include?(remote_ip)
end
private
def blocked_ips_map
Rails.cache.fetch(CACHE_KEY) { FastIpMap.new(severity_no_access.pluck(:ip)) }
end
end
private