FEATURE: clean up unmatched email/ip entries after a year

This commit is contained in:
Régis Hanol
2014-11-25 17:12:49 +01:00
parent f355d82265
commit e23a25994d
4 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
module Jobs
class CleanUpUnmatchedEmails < Jobs::Scheduled
every 1.day
def execute
last_match_threshold = SiteSetting.max_age_unmatched_emails.days.ago
ScreenedEmail.where(action_type: ScreenedEmail.actions[:block])
.where("last_match_at < ?", last_match_threshold)
.destroy_all
end
end
end

View File

@@ -0,0 +1,16 @@
module Jobs
class CleanUpUnmatchedIPs < Jobs::Scheduled
every 1.day
def execute
last_match_threshold = SiteSetting.max_age_unmatched_ips.days.ago
ScreenedIpAddress.where(action_type: ScreenedIpAddress.actions[:block])
.where("last_match_at < ?", last_match_threshold)
.destroy_all
end
end
end