thread_resolve_worker.rb 479 B

123456789101112131415161718192021
  1. # frozen_string_literal: true
  2. class ThreadResolveWorker
  3. include Sidekiq::Worker
  4. sidekiq_options queue: 'pull', retry: 3
  5. sidekiq_retry_in do |count|
  6. 15 + 10 * (count**4) + rand(10 * (count**4))
  7. end
  8. def perform(child_status_id, parent_url)
  9. child_status = Status.find(child_status_id)
  10. parent_status = FetchRemoteStatusService.new.call(parent_url)
  11. return if parent_status.nil?
  12. child_status.thread = parent_status
  13. child_status.save!
  14. end
  15. end