Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Caching GraphQL queries #2181
Caching GraphQL queries #2181
Conversation
Also brought `FileCache` into our source instead of importing its package because needed to add the `ClearRegion` method.
|
I don't mean to do this. This is a test. |
# Conflicts: # submodules/octokit.graphql.net
|
As per conversations had on slack graphql caching will be a double edged sword. We will need to review all of our usages of the graphql library to make sure caching will not result in any user experience bugs. |
Functionality to get a page of a list of pull requests
Functionality to get the pull request detail
Functionality to get the last commit of a pull request for statuses
Functionality to get a list of viewer repositories for cloning
Functionality to get a pull request node id
Functionality to get assignable users
Functionality to get the viewer details
Functionality to get a parent repo if one exists
|
|
The VisualStudio/src/GitHub.InlineReviews/Services/PullRequestSessionService.cs Lines 412 to 413 in 14eadbe |
|
Minor nitpick |
| @@ -293,6 +294,14 @@ public class PullRequestService : IssueishService, IPullRequestService, IStaticR | |||
| return result; | |||
| } | |||
|
|
|||
| public async Task ClearPullRequestsCache(HostAddress address, string owner, string name) | |||
| { | |||
| var region = owner + '/' + name + "/pr-list"; | |||
…hing # Conflicts: # src/GitHub.InlineReviews/Services/PullRequestSessionService.cs
I think it's good, but i'm probably too close now to evaluate
|
Looks good to me. Just a question about removing a Visual Studio threading dependency. |
|
While I was prepping to present at the Visual Studio 2019 launch, my head had a thought about how the caching would affect the fork function and what routine is that using... |
|
GraphQL is not used to fork repos |
|
Let's do this! |
This PR adds caching to GraphQL queries. It introduces a new
IGraphQLClientwhich is used instead of (and wraps) Octokit.GraphQL'sIConnection.When a query is submitted, this class hashes the query and uses this as a cache key. Queries are cached in the filesystem using a slightly modified version of https://github.com/acarteas/FileCache.
The main complication here is that if you have say 3 pages worth of the PR list cached then pressing "Refresh" needs to clear all pages of the PR list. We use the region name to identify such queries and when refresh is pressed, call
FileCache.ClearRegion. This method isn't present in the mainline FileCache which is why we ship a slightly modified version of it.Depends on octokit/octokit.graphql.net#186