diff options
Diffstat (limited to 'app/workers/scheduler')
-rw-r--r-- | app/workers/scheduler/defederating_statuses_scheduler.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/workers/scheduler/defederating_statuses_scheduler.rb b/app/workers/scheduler/defederating_statuses_scheduler.rb new file mode 100644 index 000000000..91a644e02 --- /dev/null +++ b/app/workers/scheduler/defederating_statuses_scheduler.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class Scheduler::DefederatingStatusesScheduler + include Sidekiq::Worker + + sidekiq_options unique: :until_executed, retry: 0 + + def perform + due_statuses.find_each do |defederating_status| + DefederateStatusWorker.perform_async(defederating_status.id) + end + end + + private + + def due_statuses + DefederatingStatus.where('defederate_after <= ?', Time.now.utc) + end +end |