Follow-up from "Update service to create New Subscription opportunity objects"
The following discussion from !2459 should be addressed:
-
@vshumilo started a discussion: (+1 comment) I guess one optimization I can suggest here (perfectly fits in a follow up) is to try and minimize the number of calls we perform to Zuora, one small win I can think of here is to query in some way like:
# this is pseudocode, probably will not work out of the box rate_plan_charge_ids = invoice_items.map(&:rate_plan_charge_id) # and then rate_plan_charges = Zuora::RatePlanCharge.where(id: rate_plan_charge_ids)
And similarly preloaded sets for
rate_plan_charge.rate_plan
,rate_plan_charge.product_rate_plan
might be possible to build.Then we will have to use ruby
find
or something alike to get the values we need within theeach
iteration but maybe that is a price we are willing to pay if that saves us some Zuora calls.Again: This is not a requested change as per this MR, this definitely can be a follow up
Also consider https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/2459#note_482713221 for this optimization.