Bug #16921
closedCall candlepin's subscriptions just once when enabling a repo
Description
Enabling a repository requires two calls of candlepin's subscriptions - once for getting entitlement certificate, once for getting its key. Since each such candlepin call means generating & sending over SSL & processing several MBs of data (since all subscriptions to all products are retrieved from candlepin), the repository enable takes redundant time.
Let call the candlepin GET request just once and store the values in another lazy accessor variable.
Reproducer: enable a repo and meantime grep in candlepin logs for:
2016-10-13 17:42:19,759 [thread=http-bio-8443-exec-6] [req=508b0bd7-6540-4431-a3c7-2d521ff463ee, org=] INFO org.candlepin.common.filter.LoggingFilter - Request: verb=GET, uri=/candlepin/owners/Default_Organization/subscriptions
that will appear twice.
With the fix I will propose, I was able to decrease the time for enabling a repo from 7s to 5s on my machine.