diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-11-18 04:39:27 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-11-18 04:39:27 -0600 |
commit | 345c6beb7e8a26e3537506ab3134c509d4ef6dc8 (patch) | |
tree | f7c26aa34d2324bc3e89ebffa27b48336be6ede0 | |
parent | 2c32b36a57c7e00c34b06d3c223b291e06c651cc (diff) |
Auto-remove expired filters.
-rw-r--r-- | app/workers/scheduler/filter_cleanup_scheduler.rb | 11 | ||||
-rw-r--r-- | config/sidekiq.yml | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/app/workers/scheduler/filter_cleanup_scheduler.rb b/app/workers/scheduler/filter_cleanup_scheduler.rb new file mode 100644 index 000000000..8e1e4db81 --- /dev/null +++ b/app/workers/scheduler/filter_cleanup_scheduler.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class Scheduler::FilterCleanupScheduler + include Sidekiq::Worker + + sidekiq_options unique: :until_executed + + def perform + CustomFilter.expired.in_batches.destroy_all + end +end diff --git a/config/sidekiq.yml b/config/sidekiq.yml index 7c2092315..89adb59e2 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -43,6 +43,9 @@ ip_cleanup_scheduler: cron: '<%= Random.rand(0..59) %> <%= Random.rand(3..5) %> * * *' class: Scheduler::IpCleanupScheduler + filter_cleanup_scheduler: + every: '15m' + class: Scheduler::FilterCleanupScheduler email_scheduler: cron: '0 10 * * 2' class: Scheduler::EmailScheduler |