Enrich coverage for `IpBlock` model (#32471)

pull/2889/head
Matt Jankowski 2024-10-25 04:35:07 -04:00 committed by GitHub
parent 15f6336cdd
commit 66c0471515
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

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