Class: Jobs::CleanUpUnmatchedIPs
- Defined in:
- app/jobs/scheduled/clean_up_unmatched_ips.rb
Instance Method Summary collapse
Methods inherited from Scheduled
Methods inherited from Base
acquire_cluster_concurrency_lock!, clear_cluster_concurrency_lock!, cluster_concurrency, cluster_concurrency_redis_key, delayed_perform, #error_context, get_cluster_concurrency, #last_db_duration, #log, #perform, #perform_immediately
Instance Method Details
#execute(args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/jobs/scheduled/clean_up_unmatched_ips.rb', line 7 def execute(args) # roll-up IP addresses first ScreenedIpAddress.roll_up last_match_threshold = SiteSetting.max_age_unmatched_ips.days.ago # remove old unmatched IP addresses ScreenedIpAddress .where(action_type: ScreenedIpAddress.actions[:block]) .where( "last_match_at < ? OR (last_match_at IS NULL AND created_at < ?)", last_match_threshold, last_match_threshold, ) .destroy_all end |