hometown/app/workers/scheduler/subscriptions_scheduler.rb
Eugen Rochko 6e9eda5331 ActivityPub migration procedure (#4617)
* ActivityPub migration procedure

Once one account is detected as going from OStatus to ActivityPub,
invalidate WebFinger cache for other accounts from the same domain

* Unsubscribe from PuSH updates once we receive an ActivityPub payload

* Re-subscribe to PuSH unless already unsubscribed, regardless of protocol
2017-08-21 01:14:40 +02:00

20 lines
388 B
Ruby

# frozen_string_literal: true
require 'sidekiq-scheduler'
require 'sidekiq-bulk'
class Scheduler::SubscriptionsScheduler
include Sidekiq::Worker
def perform
logger.info 'Queueing PuSH re-subscriptions'
Pubsubhubbub::SubscribeWorker.push_bulk(expiring_accounts.pluck(:id))
end
private
def expiring_accounts
Account.expiring(1.day.from_now).partitioned
end
end