From 345c6beb7e8a26e3537506ab3134c509d4ef6dc8 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Mon, 18 Nov 2019 04:39:27 -0600 Subject: Auto-remove expired filters. --- app/workers/scheduler/filter_cleanup_scheduler.rb | 11 +++++++++++ config/sidekiq.yml | 3 +++ 2 files changed, 14 insertions(+) create mode 100644 app/workers/scheduler/filter_cleanup_scheduler.rb 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 -- cgit