闭社主体 forked from https://github.com/tootsuite/mastodon
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.

21 lines
479 B

  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