diff options
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/scheduler/subscriptions_scheduler.rb | 6 | ||||
-rw-r--r-- | app/workers/soft_block_domain_followers_worker.rb | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/app/workers/scheduler/subscriptions_scheduler.rb b/app/workers/scheduler/subscriptions_scheduler.rb index 3ea3ad2b8..7bfd002f4 100644 --- a/app/workers/scheduler/subscriptions_scheduler.rb +++ b/app/workers/scheduler/subscriptions_scheduler.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true + require 'sidekiq-scheduler' +require 'sidekiq-bulk' class Scheduler::SubscriptionsScheduler include Sidekiq::Worker @@ -7,9 +9,7 @@ class Scheduler::SubscriptionsScheduler def perform logger.info 'Queueing PuSH re-subscriptions' - expiring_accounts.pluck(:id).each do |id| - Pubsubhubbub::SubscribeWorker.perform_async(id) - end + Pubsubhubbub::SubscribeWorker.push_bulk(expiring_accounts.pluck(:id)) end private diff --git a/app/workers/soft_block_domain_followers_worker.rb b/app/workers/soft_block_domain_followers_worker.rb index 2782d05d2..ce76683c5 100644 --- a/app/workers/soft_block_domain_followers_worker.rb +++ b/app/workers/soft_block_domain_followers_worker.rb @@ -1,13 +1,16 @@ # frozen_string_literal: true +require 'sidekiq-bulk' + class SoftBlockDomainFollowersWorker include Sidekiq::Worker sidekiq_options queue: 'pull' def perform(account_id, domain) - Account.find(account_id).followers.where(domain: domain).pluck(:id).each do |follower_id| - SoftBlockWorker.perform_async(account_id, follower_id) + followers_id = Account.find(account_id).followers.where(domain: domain).pluck(:id) + SoftBlockWorker.push_bulk(followers_id) do |follower_id| + [account_id, follower_id] end end end |