You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
469 B

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