query the slave for settings and Account#account_users_for
Change-Id: Ie423821410080c361d44faa8619ee56321e3bdbd Reviewed-on: https://gerrit.instructure.com/13230 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Zach Wily <zach@instructure.com>
This commit is contained in:
parent
c10f5578e9
commit
acee113da4
|
@ -545,9 +545,11 @@ class Account < ActiveRecord::Base
|
|||
def account_users_for(user)
|
||||
@account_chain_ids ||= self.account_chain(:include_site_admin => true).map { |a| a.active? ? a.id : nil }.compact
|
||||
@account_users_cache ||= {}
|
||||
@account_users_cache[user] ||= Shard.partition_by_shard(@account_chain_ids) do |account_chain_ids|
|
||||
AccountUser.find(:all, :conditions => { :account_id => account_chain_ids, :user_id => user.id })
|
||||
end if user
|
||||
ActiveRecord::Base::ConnectionSpecification.with_environment(:slave) do
|
||||
@account_users_cache[user] ||= Shard.partition_by_shard(@account_chain_ids) do |account_chain_ids|
|
||||
AccountUser.find(:all, :conditions => { :account_id => account_chain_ids, :user_id => user.id })
|
||||
end if user
|
||||
end
|
||||
@account_users_cache[user] ||= []
|
||||
@account_users_cache[user]
|
||||
end
|
||||
|
|
|
@ -22,7 +22,9 @@ class Setting < ActiveRecord::Base
|
|||
@@cache = {}
|
||||
|
||||
def self.get(name, default)
|
||||
Setting.find_or_initialize_by_name(name, :value => default).value
|
||||
ActiveRecord::Base::ConnectionSpecification.with_environment(:slave) do
|
||||
Setting.find_or_initialize_by_name(name, :value => default).value
|
||||
end
|
||||
end
|
||||
|
||||
def self.set(name, value)
|
||||
|
|
Loading…
Reference in New Issue