thread_resolve_worker.rb 469 B

1234567891011121314151617181920
  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