limit facebook user searching to pertinent shards

closes CNVS-3834

test plan:
 * facebook app should still work

Change-Id: Ifd892a0b00afa173ec1d9d1f973955c3fbb806a1
Reviewed-on: https://gerrit.instructure.com/17662
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
This commit is contained in:
Cody Cutrer 2013-02-12 14:31:05 -07:00
parent b0a8cdb3a1
commit 023e5151d0
2 changed files with 6 additions and 2 deletions

View File

@ -109,7 +109,7 @@ class FacebookController < ApplicationController
data, sig = Facebook.parse_signed_request(params[:signed_request])
if data && sig
if @facebook_user_id = data['user_id']
Shard.with_each_shard do
Shard.with_each_shard(UserService.associated_shards('facebook', @facebook_user_id)) do
@service = UserService.find_by_service_and_service_user_id('facebook', @facebook_user_id)
break if @service
end
@ -130,7 +130,7 @@ class FacebookController < ApplicationController
@service = @user.user_services.find_by_service('facebook')
elsif session[:facebook_user_id]
@facebook_user_id = session[:facebook_user_id]
Shard.with_each_shard do
Shard.with_each_shard(UserService.associated_shards('facebook', @facebook_user_id)) do
@service = UserService.find_by_service_and_service_user_id('facebook', @facebook_user_id)
break if @service
end

View File

@ -280,4 +280,8 @@ class UserService < ActiveRecord::Base
end
end
def self.serialization_excludes; [:crypted_password, :password_salt, :token, :secret]; end
def self.associated_shards(service, service_user_id)
[Shard.default]
end
end