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.

16 lines
673 B

  1. # frozen_string_literal: true
  2. class Pubsubhubbub::DistributionWorker
  3. include Sidekiq::Worker
  4. def perform(stream_entry_id)
  5. stream_entry = StreamEntry.find(stream_entry_id)
  6. account = stream_entry.account
  7. renderer = AccountsController.renderer.new(method: 'get', http_host: Rails.configuration.x.local_domain, https: Rails.configuration.x.use_https)
  8. payload = renderer.render(:show, assigns: { account: account, entries: [stream_entry] }, formats: [:atom])
  9. Subscription.where(account: account).active.select('id').find_each do |subscription|
  10. Pubsubhubbub::DeliveryWorker.perform_async(subscription.id, payload)
  11. end
  12. end
  13. end