processing_worker.rb 649 B

1234567891011121314151617181920
  1. # frozen_string_literal: true
  2. class ActivityPub::ProcessingWorker
  3. include Sidekiq::Worker
  4. sidekiq_options queue: 'ingress', backtrace: true, retry: 8
  5. def perform(actor_id, body, delivered_to_account_id = nil, actor_type = 'Account')
  6. case actor_type
  7. when 'Account'
  8. actor = Account.find_by(id: actor_id)
  9. end
  10. return if actor.nil?
  11. ActivityPub::ProcessCollectionService.new.call(body, actor, override_timestamps: true, delivered_to_account_id: delivered_to_account_id, delivery: true)
  12. rescue ActiveRecord::RecordInvalid => e
  13. Rails.logger.debug { "Error processing incoming ActivityPub object: #{e}" }
  14. end
  15. end