Refactor Repositories::DestroyService to remove run_after_commit
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Repositories::DestroyService calls container.run_after_commit.
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 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.
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.
Risks
Involved components
Optional: Intended side effects
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.