Bug #26365
closedKatello::Pool.import_all unnecessarily slow
Description
On a scaled environment with thousands of pools, katello:import_subscriptions (called e.g. during an upgrade) does call
Katello::Pool.import_all
that traverses over each and every pool and imports hosts and namely Activation Keys from candlepin. That means, a call like:
/candlepin/owners/RedHat/activation_keys/?include=id&include=pools.pool.id
is repeatedly requested for each and every pool.
If such a request takes longer, overall upgrade time is redundantly increased.
How reproducible:
100%
Steps to Reproduce:
1. Have a system with some AKs and more pools in manifest - the more the better.
2. in one terminal:
tail -f /var/log/candlepin/candlepin.log | grep "/activation_keys/?include=id&include=pools.pool.id"
3. in 2nd terminal:
foreman-rake katello:import_subscriptions
4. count number of lines printed in the 1st terminal
Actual results:
4. shows as many logs / queries to candlepin as the number of pools is (plus one, I think).
Expected results:
4. to show just 1 or 2 such queries