raw_distribution_worker.rb 525 B

12345678910111213141516171819202122
  1. # frozen_string_literal: true
  2. class Pubsubhubbub::RawDistributionWorker
  3. include Sidekiq::Worker
  4. sidekiq_options queue: 'push'
  5. def perform(xml, source_account_id)
  6. @account = Account.find(source_account_id)
  7. @subscriptions = active_subscriptions.to_a
  8. Pubsubhubbub::DeliveryWorker.push_bulk(@subscriptions) do |subscription|
  9. [subscription.id, xml]
  10. end
  11. end
  12. private
  13. def active_subscriptions
  14. Subscription.where(account: @account).active.select('id, callback_url, domain')
  15. end
  16. end