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

class DestructStatusWorker
  include Sidekiq::Worker

  sidekiq_options unique: :until_executed

  def perform(destructing_status_id)
    destructing_status = DestructingStatus.find(destructing_status_id)
    destructing_status.destroy!

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