regeneration_worker.rb 394 B

1234567891011121314151617181920
  1. # frozen_string_literal: true
  2. class RegenerationWorker
  3. include Sidekiq::Worker
  4. include DatabaseHelper
  5. sidekiq_options lock: :until_executed
  6. def perform(account_id, _ = :home)
  7. with_primary do
  8. @account = Account.find(account_id)
  9. end
  10. with_read_replica do
  11. PrecomputeFeedService.new.call(@account)
  12. end
  13. rescue ActiveRecord::RecordNotFound
  14. true
  15. end
  16. end