use in_region_associated_shards in some more places

refs #CNVS-38980

Change-Id: I8da10dca766ff0317c9a035b09dd1a0df41a84e6
Reviewed-on: https://gerrit.instructure.com/124882
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
This commit is contained in:
James Williams 2017-09-05 07:45:43 -06:00
parent 40df3a1865
commit 09c770502f
2 changed files with 3 additions and 3 deletions

View File

@ -2875,9 +2875,9 @@ class User < ActiveRecord::Base
def adminable_accounts
@adminable_accounts ||= shard.activate do
Rails.cache.fetch(['adminable_accounts', self, ApplicationController.region].cache_key) do
Account.shard(self).active.joins(:account_users).
Account.shard(self.in_region_associated_shards).active.joins(:account_users).
where(account_users: {user_id: self.id}).
where.not(account_users: {workflow_state: 'deleted'})
where.not(account_users: {workflow_state: 'deleted'}).to_a
end
end
end

View File

@ -823,7 +823,7 @@ class MessageableUser
@shard_caches[key] ||=
begin
by_shard = {}
Shard.with_each_shard(@user.associated_shards) do
Shard.with_each_shard(@user.in_region_associated_shards) do
shard_key = [@user, 'messageable_user', key]
methods.each do |method|
canonical = send(method).cache_key