Skip to content

Move repo existence checking

What does this MR do and why?

In this MR we're trying to fix a race condition when the repo does not exists after checking its existence.

In Repository::DestroyService and Repository::DestroyRollbackService we check for the repository existence right at the beginning of the service. But it might happened that after that check, the repo could have been removed, making the operation repository.before_delete, fail with the exception Gitlab::Git::Repository::NoRepository.

Here we're capturing that exception in case it pops and returning gracefully since the services don't need to do anything.

We've also adjusted the logic in the mv_repository method because it was wrong and we could end up scheduling jobs when we shouldn't.

MR acceptance checklist

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

Related to #235192 (closed)

Merge request reports