katello
katello copied to clipboard
Fixes #37871 - Granular capsule update content counts
What are the changes introduced in this pull request?
The PR introduces parameters to control granularity of the smart proxy content counting method.
Considerations taken when implementing this change?
I had to acquire a lock on the proxy record because parallel sync tasks run for individual environments when a CV version is promoted to them. And each individual sync task triggers it's own content counting leading to a race condition where the last task that saves content_counts overwrites changes by other tasks.
What are the testing steps for this pull request?
To test:
- Test global content counting still works by running a capsule sync.
- To test granular content counting, turn the automatic counting off, make some changes isolated to one CV, publish, promote etc and ensure the content counts remain stale.
- Turn the automatic counting setting on and then promote a different CV to an env tied to a proxy.
- On this branch, post the sync and content count task, only the specific CV version repo counts will get updated. You can verify that in JSON value on proxy or on the UI for easy testing.