闭社主体 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.

22 lines
525 B

  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