Skip to content

Move the cleanup policies cache object

🍋 Context

Cleanup policies for container images are executed by a background job. That execution involves an orchestrated interaction with the Container Registry API.

Those network requests to the Container Registry API were the main culprit of slowing down the whole execution. In !69459 (merged), we implemented a cache so that some of those requests are skipped = faster execution times.

At that time, the cache has been implemented as a service but it felt strange to have it there as it's not really a service but more an object with only two public methods:

  • read entries from the cache
  • write an entry to the cache

After following the discussions in !71343 (merged), I felt that this was the right candidate to not be a service.

This MR will simply move the cache class to lib as documented in the guideline: https://docs.gitlab.com/ee/development/reusing_abstractions.html#service-classes

🤔 What does this MR do and why?

  • Move app/services/projects/container_repository/cache_tags_created_at_service.rb to app/services/projects/container_repository/cleanup_tags_service.rb
  • Update the callers of the cache
  • Move the related specs

No functional changes

No documentation or CHANGELOG as this is removing ~"technical debt"

📷 Screenshots or screen recordings

n / a

👽 How to set up and validate locally

See !69459 (merged)

🛃 MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by David Fernandez

Merge request reports