mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-27 10:31:36 +01:00
0c9eac80d8
* Add a limit to how many posts can get fetched as a result of a single request * Add tests * Always pass `request_id` when processing `Announce` activities --------- Co-authored-by: nametoolong <nametoolong@users.noreply.github.com>
20 lines
514 B
Ruby
20 lines
514 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ThreadResolveWorker
|
|
include Sidekiq::Worker
|
|
include ExponentialBackoff
|
|
|
|
sidekiq_options queue: 'pull', retry: 3
|
|
|
|
def perform(child_status_id, parent_url, options = {})
|
|
child_status = Status.find(child_status_id)
|
|
parent_status = FetchRemoteStatusService.new.call(parent_url, **options.deep_symbolize_keys)
|
|
|
|
return if parent_status.nil?
|
|
|
|
child_status.thread = parent_status
|
|
child_status.save!
|
|
rescue ActiveRecord::RecordNotFound
|
|
true
|
|
end
|
|
end
|