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