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.

20 lines
389 B

  1. # frozen_string_literal: true
  2. require 'sidekiq-scheduler'
  3. require 'sidekiq-bulk'
  4. class Scheduler::SubscriptionsScheduler
  5. include Sidekiq::Worker
  6. def perform
  7. logger.info 'Queueing PuSH re-subscriptions'
  8. Pubsubhubbub::SubscribeWorker.push_bulk(expiring_accounts.pluck(:id))
  9. end
  10. private
  11. def expiring_accounts
  12. Account.expiring(1.day.from_now).partitioned
  13. end
  14. end