about summary refs log tree commit diff
path: root/app/workers/scheduler/subscriptions_scheduler.rb
blob: 03622e95bc6d65a8c97061d908eb377253203876 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true
require 'sidekiq-scheduler'

class Scheduler::SubscriptionsScheduler
  include Sidekiq::Worker

  def perform
    Rails.logger.debug 'Queueing PuSH re-subscriptions'

    expiring_accounts.pluck(:id) do |id|
      Pubsubhubbub::SubscribeWorker.perform_async(id)
    end
  end

  private

  def expiring_accounts
    Account.expiring(1.day.from_now).partitioned
  end
end