about summary refs log tree commit diff
path: root/app/workers/scheduler/defederating_statuses_scheduler.rb
blob: 91a644e02bc97cdfdb7258604a0a663e339f8c80 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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