Right now CommerceLicenseBillingUsageGroupBase::freeQuantities() loads the revision of each plan through entity_revision_load. There is no static cache there, which means that for N usage groups all of the plan's revisions will be loaded N times.
We can fix this by preloading the revision in commerce_license_billing_plan_history_list() instead.
So there would be a 'revision' key with a license in that revision ($license if it's the current revision, if not, the previous loaded revision). It's a small performance hit for licenses that don't use usage, but it makes sense API wise.

Comments

bojanz’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.