-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Conversation
Also brought `FileCache` into our source instead of importing its package because needed to add the `ClearRegion` method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The refresh
flag should be chained down to this call
VisualStudio/src/GitHub.InlineReviews/Services/PullRequestSessionService.cs
Lines 412 to 413 in 14eadbe
var lastCommitModel = await log.TimeAsync(nameof(GetPullRequestLastCommitAdapter), | |
() => GetPullRequestLastCommitAdapter(address, owner, name, number)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With that.
…hing # Conflicts: # src/GitHub.InlineReviews/Services/PullRequestSessionService.cs
I think it's good, but i'm probably too close now to evaluate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do this!
This PR adds caching to GraphQL queries. It introduces a new
IGraphQLClient
which 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