about summary refs log tree commit diff
path: root/app/workers/defederate_status_worker.rb
blob: bae4be9b8c1a7d60958d50e8ec5ddeeb0940b5fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

class DefederateStatusWorker
  include Sidekiq::Worker

  sidekiq_options unique: :until_executed

  def perform(defederating_status_id)
    defederating_status = DefederatingStatus.find(defederating_status_id)
    defederating_status.destroy!

    RemoveStatusService.new.call(defederating_status.status, defederate_only: true)
    true
  rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid
    true
  end
end