about summary refs log tree commit diff
path: root/app/workers/destruct_status_worker.rb
blob: 6a39712207135245a0a5e4f7f3bba0c3d1bbb28c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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)
  rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid
    true
  end
end