This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2017-05-05 02:23:01 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
require 'sidekiq-scheduler'
|
|
|
|
|
|
|
|
class Scheduler::SubscriptionsScheduler
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
|
|
|
def perform
|
2017-05-06 13:05:03 +02:00
|
|
|
logger.info 'Queueing PuSH re-subscriptions'
|
2017-05-05 02:23:01 +02:00
|
|
|
|
2017-05-06 13:05:03 +02:00
|
|
|
expiring_accounts.pluck(:id).each do |id|
|
2017-05-05 02:23:01 +02:00
|
|
|
Pubsubhubbub::SubscribeWorker.perform_async(id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def expiring_accounts
|
|
|
|
Account.expiring(1.day.from_now).partitioned
|
|
|
|
end
|
|
|
|
end
|