add_to_public_statuses_index_worker.rb 424 B

12345678910111213141516171819202122
  1. # frozen_string_literal: true
  2. class AddToPublicStatusesIndexWorker
  3. include Sidekiq::Worker
  4. include DatabaseHelper
  5. sidekiq_options queue: 'pull'
  6. def perform(account_id)
  7. with_primary do
  8. @account = Account.find(account_id)
  9. end
  10. return unless @account.indexable?
  11. with_read_replica do
  12. @account.add_to_public_statuses_index!
  13. end
  14. rescue ActiveRecord::RecordNotFound
  15. true
  16. end
  17. end