Skip to content

GitHub authz: fetch repository permissions in batches of 100

Administrator requested to merge bl/gh-authz-opt into master

Created by: beyang

Partially addresses https://github.com/sourcegraph/sourcegraph/issues/3634

We compute GitHub repository permissions for a given user by attempting to fetch repositories from the GitHub API using the user's GitHub credentials (OAuth token). Prior to this change, one GitHub API request would be issued for each user-repository permission. In the case of a search query on a Sourcegraph instance with 1000s of repositories, this could mean the search result would be blocked on 1000 serial GitHub API requests. This results in a timeout error on the frontend.

This changeset uses the GitHub GraphQL API to fetch repositories in batches of 100 (the max allowed by GitHub) when computing permissions. This partially addresses the performance issue described above.

Merge request reports

Loading