gitserver: Sync cloned state periodically
Created by: ryanslade
We will now periodically sync the on disk clone state for each gitserver instance.
We iterate over all repos from the db discarding repos that the current instance is not responsible for. We can't do this in the database since we need to use the same logic that we use in the frontend which involves first normalising the repo name.
We then compare the clone state of the repo in the database with what we have on disk and perform an upsert if necessary.
Rate limiting is enforced for upserts but we only expect this to be required when doing an initial upsert or after a rebalance. Once the majority of state has been synced the number of upserts should be fairly low.