Refactor Repositories::DestroyService to remove run_after_commit
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=384586) </details> <!--IssueSummary end--> ## Summary [Repositories::DestroyService](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/repositories/destroy_service.rb#L24) calls `container.run_after_commit`[](url). In order for the repository to be deleted a commit must be made to the container after the service has been called. This is in place to facilitate [deleting project related records](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/projects/destroy_service.rb#L127) before the project is deleted. `container.run_after_commit` should be removed from Repositories::DestroyService as the service should work without the need to make another commit to the container. Projects::DestroyService might be refactored to include run_after_commit [here](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/projects/destroy_service.rb#L99). <!-- Please briefly describe what part of the code base needs to be refactored. --> ## Improvements Repositories::DestroyService will be decoupled from Projects::DestroyService. It will mean work arounds to call a commit on the container won't be necessary such as in [this MR](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105348). <!-- Explain the benefits of refactoring this code. See also https://about.gitlab.com/handbook/values/index.html#say-why-not-just-what --> ## Risks <!-- Please list features that can break because of this refactoring and how you intend to solve that. --> ## Involved components <!-- List files or directories that will be changed by the refactoring. --> ## Optional: Intended side effects <!-- If the refactoring involves changes apart from the main improvements (such as a better UI), list them here. It may be a good idea to create separate issues and link them here. --> ## Optional: Missing test coverage Not calling the destroy repo service in a `container.run_after_commit` does not break any tests. Adding a spec for this could be included in the refactor. <!-- If you are aware of tests that need to be written or adjusted apart from unit tests for the changed components, please list them here. --> <!-- Please select the appropriate label from the following: ~"feature::addition" ~"type::maintenance" ~"maintenance::refactor" ~"maintenance::pipelines" ~"maintenance::workflow" -->
issue