2017-05-04 20:23:01 -04:00
|
|
|
# frozen_string_literal: true
|
2017-06-03 18:11:15 -04:00
|
|
|
|
2017-05-04 20:23:01 -04:00
|
|
|
require 'sidekiq-scheduler'
|
2017-06-03 18:11:15 -04:00
|
|
|
require 'sidekiq-bulk'
|
2017-05-04 20:23:01 -04:00
|
|
|
|
|
|
|
class Scheduler::SubscriptionsScheduler
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
|
|
|
def perform
|
2017-05-06 07:05:03 -04:00
|
|
|
logger.info 'Queueing PuSH re-subscriptions'
|
2017-05-04 20:23:01 -04:00
|
|
|
|
2017-06-03 18:11:15 -04:00
|
|
|
Pubsubhubbub::SubscribeWorker.push_bulk(expiring_accounts.pluck(:id))
|
2017-05-04 20:23:01 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def expiring_accounts
|
|
|
|
Account.expiring(1.day.from_now).partitioned
|
|
|
|
end
|
|
|
|
end
|