You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
546 B

  1. # frozen_string_literal: true
  2. class Pubsubhubbub::SubscribeWorker
  3. include Sidekiq::Worker
  4. sidekiq_options queue: 'push', retry: 10, unique: :until_executed
  5. sidekiq_retry_in do |count|
  6. case count
  7. when 0
  8. 30.minutes.seconds
  9. when 1
  10. 2.hours.seconds
  11. when 2
  12. 12.hours.seconds
  13. else
  14. 24.hours.seconds * (count - 2)
  15. end
  16. end
  17. def perform(account_id)
  18. account = Account.find(account_id)
  19. logger.debug "PuSH re-subscribing to #{account.acct}"
  20. ::SubscribeService.new.call(account)
  21. end
  22. end