mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: clean up unmatched email/ip entries after a year
This commit is contained in:
16
app/jobs/scheduled/clean_up_unmatched_emails.rb
Normal file
16
app/jobs/scheduled/clean_up_unmatched_emails.rb
Normal 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
|
||||
16
app/jobs/scheduled/clean_up_unmatched_ips.rb
Normal file
16
app/jobs/scheduled/clean_up_unmatched_ips.rb
Normal 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
|
||||
Reference in New Issue
Block a user