unmerge_worker.rb 482 B

123456789101112131415161718192021
  1. # frozen_string_literal: true
  2. class UnmergeWorker
  3. include Sidekiq::Worker
  4. include DatabaseHelper
  5. sidekiq_options queue: 'pull'
  6. def perform(from_account_id, into_account_id)
  7. with_primary do
  8. @from_account = Account.find(from_account_id)
  9. @into_account = Account.find(into_account_id)
  10. end
  11. with_read_replica do
  12. FeedManager.instance.unmerge_from_home(@from_account, @into_account)
  13. end
  14. rescue ActiveRecord::RecordNotFound
  15. true
  16. end
  17. end