jenkinsci/github-oauth-plugin — pull request #27 by alexrothenberg (2014-07-31 20:13:46+00:00)
Title: Fewer github api calls for performance

On jenkins instances with a large number of jobs the previous implementation got very slow because it made a github api call per job & did not do a great job of caching. This pull reduces the chatter with the github api by asking which repos the user has access to and caching the results.

There are 2 big changes in this pull

### The algorithm now builds and caches a list of "my repositories"
It makes these api calls to github:
1. Get list of the non-organization repos user has access to `/api/v3/user/repos`
2. Get list of organizations with repos user has access to `/api/v3/user/orgs`. For each organization
- Get a list of repos in that org user has access to `/api/v3/orgs/XXX/repos`

Because of pagination it sometimes makes several calls to get the full list of repos.

### Cache list of public repositories for read-only access.
For this it still makes an api call per repository but caches the results for all users.

On my jenkins instance with ~400 projects this has improved performance from unusable (minutes to load the home page) to pretty fast (~4 seconds as it builds the cache and faster after that).