Use a writing role for some sidekiq worker reads
This commit is contained in:
parent
de7d71e0ee
commit
4696307cc9
@ -4,6 +4,8 @@ class BootstrapTimelineWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(account_id)
|
||||
ActiveRecord::Base.connected_to(role: :writing) do
|
||||
BootstrapTimelineService.new.call(Account.find(account_id))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -8,10 +8,12 @@ class LocalNotificationWorker
|
||||
def perform(receiver_account_id, activity_id = nil, activity_class_name = nil)
|
||||
return true if activity_id.nil? or activity_class_name.nil?
|
||||
|
||||
ActiveRecord::Base.connected_to(role: :writing) do
|
||||
receiver = Account.find(receiver_account_id)
|
||||
activity = activity_class_name.constantize.find(activity_id)
|
||||
|
||||
NotifyService.new.call(receiver, activity)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user