2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-02-08 12:47:35 -05:00
|
|
|
module Jobs
|
|
|
|
|
2019-10-02 00:01:53 -04:00
|
|
|
class CleanUpEmailLogs < ::Jobs::Scheduled
|
2016-02-08 12:47:35 -05:00
|
|
|
every 1.day
|
|
|
|
|
|
|
|
def execute(args)
|
2016-02-08 16:18:52 -05:00
|
|
|
return if SiteSetting.delete_email_logs_after_days <= 0
|
2016-02-08 12:47:35 -05:00
|
|
|
|
2016-02-08 16:18:52 -05:00
|
|
|
threshold = SiteSetting.delete_email_logs_after_days.days.ago
|
2016-02-08 12:47:35 -05:00
|
|
|
|
2018-07-27 00:32:07 -04:00
|
|
|
EmailLog.where("created_at < ?", threshold).delete_all
|
2018-07-24 00:55:43 -04:00
|
|
|
SkippedEmailLog.where("created_at < ?", threshold).delete_all
|
2016-02-08 12:47:35 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|