about summary refs log tree commit diff
path: root/app/workers/destruct_status_worker.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers/destruct_status_worker.rb')
-rw-r--r--app/workers/destruct_status_worker.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/workers/destruct_status_worker.rb b/app/workers/destruct_status_worker.rb
new file mode 100644
index 000000000..6a3971220
--- /dev/null
+++ b/app/workers/destruct_status_worker.rb
@@ -0,0 +1,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