THREESCALE-9973: Bullet n plus 1 offences#4305
Open
madnialihussain wants to merge 8 commits into
Open
Conversation
❌ 3 blocking issues (4 total)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it
This PR removes
10 n_plus_one_querysafelist entries fromconfig/environments/test.rbby fixing the underlying N+1 queries with proper eager loading.The changes include:
.includesAVOID eager loadingwarningsRelated issue: THREESCALE-9973
Changes by commit
1cf51db5fAdd conditional
:serviceinclude toApplicationsIndexPresenter(only when no service filter and multiservice) and add:service+user_account: [:admin_user]includes toBuyers::Applications::Bulk::BaseController.Removes:
Cinstance :serviceec7a2790dAdd conditional
:user_accountinclude toApplicationsIndexPresenter(only when no buyer context).Removes:
Cinstance :user_accountf728eaf8aExtend
user_accountinclude touser_account: [:admin_user]inApplicationsIndexPresenter.The view accesses
account.admin_uservialink_to_buyer_or_deleted.Removes:
Account :admin_user4d5cd6a3aAdd conditional
bought_account_planandbought_account_contract: [:plan]includes toBuyers::AccountsIndexPresenter(only whenaccount_plans_size > 1).Removes:
Account :bought_account_planAccount :bought_account_contractd48671d19Add
.includes(:user)to proxy configs collection query and decouple single-record finder to avoidAVOID eager loadingwarnings on show action.Removes:
ProxyConfig :usere5d3f9928Add
.includes(message: { sender: [:admin_user] })to inbox controller and.includes(:sender)to trash controller.MessageRecipient(sender accessed throughMessage)MessagedirectlyRemoves:
Message :sendercf283f0c4Add
.includes({ buyer_account: [:admin_user] }, :provider_account)toFinance::Provider::InvoicesIndexPresenterand.includes(:buyer_account, :provider_account)toProvider::Admin::Account::InvoicesController.Removes:
Invoice :buyer_accountInvoice :provider_accountba9d0b49cUse
ActiveRecord::Associations::Preloaderto conditionally preload:member_permissionsonly for member users inUsersIndexPresenter, avoidingAVOID eager loadingwarnings when all users are admins.Removes:
User :member_permissions