Delete Container Repository Worker follow ups
⚙ New background job
In #217702 (closed), we introduced a new background worker to deal with the delete container repository operation.
It took 2 milestones to deploy that new job and observe that it was working properly. During those 2 milestones, other improvements around remove a container repository has been made and could be useful to this new job.
🚀 Improvements
- The logic of the new background job is exactly the same as the destroy container repository service. As such, we have a code duplication that we can avoid by simply re-using the service.
- How the new background job picks the next container repository to remove is currently quite random (eg. left to the database planner). We have a new column called
status_updated_at
. This is a timestamp that gets updated when thestatus
is updated.- Use that timestamp to order and pick the next container repository. Basically, pick the oldest
status_updated_at
first. Why oldest? Because that's the container repository that is waiting its destruction for the longest time.
- Use that timestamp to order and pick the next container repository. Basically, pick the oldest