Do not allow concurrent replication
In https://gitlab.com/gitlab-org/gitaly/issues/2436, we noticed slow replication. One potential reason for this is because we are generating too many duplicate replication jobs. One way we can solve this is to have a lockfile replication.lock
that ReplicateRepository
creates in the repository folder.
This way, we can prevent multiple replication calls happening at the same time.
Another way would be to disallow replication jobs from even starting for the same repository if there is already one in progress.
Edited by John Cai