about summary refs log tree commit diff
path: root/app/workers/scheduler/status_cleanup_scheduler.rb
blob: 161818355abb92d0a70518f5f236f24a0c98bd21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

class Scheduler::StatusCleanupScheduler
  include Sidekiq::Worker

  sidekiq_options lock: :until_executed, retry: 0

  def perform
    Status.with_discarded.expired.find_each do |status|
      RemoveStatusService.new.call(status, unpublish: !(status.discarded? || status.account&.user&.setting_unpublish_delete))
    end
  end
end