about summary refs log tree commit diff
path: root/app/workers/thread_resolve_worker.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-12-12 21:12:19 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-12-12 21:12:19 +0100
commit668013265c3153383088d9dd53970ae837c1d405 (patch)
treee2794433dc0f4548d33c505e5d75383526425efa /app/workers/thread_resolve_worker.rb
parent908fcf83c6a2df34769f04c98fbe0edf31f6959f (diff)
Restoring old async behaviour of thread resolving as it proved to be more robust
Diffstat (limited to 'app/workers/thread_resolve_worker.rb')
-rw-r--r--app/workers/thread_resolve_worker.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/workers/thread_resolve_worker.rb b/app/workers/thread_resolve_worker.rb
new file mode 100644
index 000000000..84eae73be
--- /dev/null
+++ b/app/workers/thread_resolve_worker.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class ThreadResolveWorker
+  include Sidekiq::Worker
+
+  def perform(child_status_id, parent_url)
+    child_status  = Status.find(child_status_id)
+    parent_status = FetchRemoteStatusService.new.call(parent_url)
+
+    return if parent_status.nil?
+
+    child_status.thread = parent_status
+    child_status.save!
+  end
+end