Skip to content

Faster ReposourceCloneURLToRepoName

Administrator requested to merge rs/faster-ReposourceCloneURLToRepoName into main

Created by: ryanslade

We noticed that on sourcegraph.com running ReposourceCloneURLToRepoName could be very slow, often take more than 3 seconds to return.

There were two problems:

  1. We fetch up to 500 external services at a time
  2. For each service, we need to decrypt config which makes an API call taking around 7m. These were run in sequence.

This PR improves the performance in four ways:

  1. As a fast path, should be able to get the repo name from external_service_repos table in a simple query if we already have the repo cloned.
  2. If that fails, we first try our cloud_default external services as they'll match the majority of repos.
  3. We fetch in smaller batches
  4. We make the API calls to decrypt in parallel.

Found while investigating https://github.com/sourcegraph/sourcegraph/issues/23775

Merge request reports

Loading