Change notifications API to use a replica (#25874)
This commit is contained in:
@@ -3,14 +3,15 @@
|
||||
class MergeWorker
|
||||
include Sidekiq::Worker
|
||||
include Redisable
|
||||
include DatabaseHelper
|
||||
|
||||
def perform(from_account_id, into_account_id)
|
||||
ApplicationRecord.connected_to(role: :primary) do
|
||||
with_primary do
|
||||
@from_account = Account.find(from_account_id)
|
||||
@into_account = Account.find(into_account_id)
|
||||
end
|
||||
|
||||
ApplicationRecord.connected_to(role: :read, prevent_writes: true) do
|
||||
with_read_replica do
|
||||
FeedManager.instance.merge_into_home(@from_account, @into_account)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
Reference in New Issue
Block a user