10000 Caching GraphQL queries by grokys · Pull Request #2181 · github/VisualStudio · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Caching GraphQL queries #2181

Merged
merged 20 commits into from
Apr 4, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3d1ea19
Added caching to GraphQL connections.
grokys Jan 7, 2019
b046d6d
Implement refreshing PR list and details.
grokys Jan 16, 2019
bbdcf99
Merge branch 'master' into feature/graphql-caching
StanleyGoldman Feb 27, 2019
14eadbe
Update submodule
StanleyGoldman Feb 27, 2019
ff484ab
Fixing compilation errors
StanleyGoldman Feb 28, 2019
c3b597f
Passing through the call to refresh
StanleyGoldman Feb 28, 2019
4d140c6
Merge remote-tracking branch 'remotes/origin/master' into feature/gra…
StanleyGoldman Mar 8, 2019
81ed3b4
Cache assignable users for an hour
StanleyGoldman Mar 8, 2019
63c829c
Merge branch 'master' into feature/graphql-caching
StanleyGoldman Mar 14, 2019
00da02c
Caching ReadViewer for 10 minutes
StanleyGoldman Mar 14, 2019
e9395e8
Adding functionality to refresh user repository list
StanleyGoldman Mar 14, 2019
ade3b5f
Ensuring the first load is never cached
StanleyGoldman Mar 21, 2019
f7e42eb
Disabling caching for the repository clone view
StanleyGoldman Mar 26, 2019
e6290ba
Merge remote-tracking branch 'origin/master' into feature/graphql-cac…
StanleyGoldman Mar 27, 2019
6c9874b
Fixes needed after merge
StanleyGoldman Mar 27, 2019
895bbb2
Fixing some tests
StanleyGoldman Mar 27, 2019
098cd3f
Fixing tests
StanleyGoldman Mar 28, 2019
0f46686
Fixing tests
StanleyGoldman Mar 28, 2019
415e7dd
Changing code to use Task.Run over TaskScheduler.Default
StanleyGoldman Apr 4, 2019
c8ace03
Merge remote-tracking branch 'origin/master' into feature/graphql-cac…
StanleyGoldman Apr 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'remotes/origin/master' into feature/gra…
…phql-caching
  • Loading branch information
StanleyGoldman committed Mar 8, 2019
commit 4d140c6b038c854d07bce989729dc469541e1942
45 changes: 45 additions & 0 deletions .github/ISSUE_TEMPLATE/localization_suggestion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Localization suggestion
about: Suggest an improvement to our localization
labels: localization, bug
title: 'Localization: '
---
<!-- Hello! Please read the [Contributing Guidelines](https://github.com/github/VisualStudio/blob/master/CONTRIBUTING.md) before submitting an issue regarding the GitHub Extension for Visual Studio. -->
## Language
<!-- Czech -->
<!-- German -->
<!-- Spanish -->
<!-- French -->
<!-- Italian -->
<!-- Japanese -->
<!-- Korean -->
<!-- Polish -->
<!-- Portuguese (Brazil) -->
<!-- Russian -->
<!-- Turkish -->
<!-- Chinese (Simplified) -->
<!-- Chinese (Traditional) -->

## English source
<!-- Translations are made from the English sources, please paste it here. -->
```

```

## Original Translation
<!-- Please paste the original translation here. -->
```

```

## Screenshots
<!-- Translations are sometimes provided by vendors that do not have access to the UI. Providing screenshots can give them a lot of context. -->

## Notes
<!-- If you can, please explain what is incorrect about the translation. -->

## Suggested Translation
<!-- If you can, please suggest an alternate translation. -->
```

```
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Official builds of this extension are available at [the official website](https:

[![Build status](https://ci.appveyor.com/api/projects/status/dl8is5iqwt9qf3t7/branch/master?svg=true)](https://ci.appveyor.com/project/github-windows/visualstudio/branch/master)
[![Build Status](https://github-editor-tools.visualstudio.com/VisualStudio/_apis/build/status/github.VisualStudio?branchName=master)](https://github-editor-tools.visualstudio.com/VisualStudio/_build/latest?definitionId=4&branchName=master)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/github-visual-studio/localized.svg)](https://crowdin.com/project/github-visual-studio)
[![codecov](https://codecov.io/gh/GitHub/VisualStudio/branch/master/graph/badge.svg)](https://codecov.io/gh/GitHub/VisualStudio)

[![Follow GitHub for Visual Studio](https://img.shields.io/twitter/follow/GitHubVS.svg?style=social "Follow GitHubVS")](https://twitter.com/githubvs?ref_src=twsrc%5Etfw) [![Join the chat at https://gitter.im/github/VisualStudio](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/github/VisualStudio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Expand Down
9 changes: 0 additions & 9 deletions crowdin.yml

This file was deleted.

1 change: 1 addition & 0 deletions src/GitHub.App/Services/RepositoryCloneService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public async Task CloneRepository(
catch (Exception ex)
{
log.Error(ex, "Could not clone {CloneUrl} to {Path}", cloneUrl, repositoryPath);
operatingSystem.Directory.DeleteDirectory(repositoryPath);
throw;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
using System.Reactive;
using System.Threading.Tasks;
using GitHub.Extensions;
using GitHub.Logging;
using GitHub.Models;
using GitHub.Services;
using ReactiveUI;
using Serilog;

namespace GitHub.ViewModels.GitHubPane
{
Expand All @@ -14,6 +16,8 @@ namespace GitHub.ViewModels.GitHubPane
/// </summary>
public class PullRequestReviewCommentViewModel : IPullRequestReviewFileCommentViewModel
{
static readonly ILogger log = LogManager.ForContext<PullRequestReviewCommentViewModel>();

readonly IPullRequestEditorService editorService;
readonly IPullRequestSession session;
readonly PullRequestReviewCommentModel model;
Expand Down Expand Up @@ -52,18 +56,34 @@ async Task DoOpen()
{
if (thread == null)
{
var file = await session.GetFile(RelativePath, model.Thread.CommitSha);
thread = file.InlineCommentThreads.FirstOrDefault(t => t.Comments.Any(c => c.Comment.Id == model.Id));
if(model.Thread.IsOutdated)
{
var file = await session.GetFile(RelativePath, model.Thread.OriginalCommitSha);
thread = file.InlineCommentThreads.FirstOrDefault(t => t.Comments.Any(c => c.Comment.Id == model.Id));
}
else
{
var file = await session.GetFile(RelativePath, model.Thread.CommitSha);
thread = file.InlineCommentThreads.FirstOrDefault(t => t.Comments.Any(c => c.Comment.Id == model.Id));

if(thread?.LineNumber == -1)
{
log.Warning("Couldn't find line number for comment on {RelativePath} @ {CommitSha}", RelativePath, model.Thread.CommitSha);
// Fall back to opening outdated file if we can't find a line number for the comment
file = await session.GetFile(RelativePath, model.Thread.OriginalCommitSha);
thread = file.InlineCommentThreads.FirstOrDefault(t => t.Comments.Any(c => c.Comment.Id == model.Id));
}
}
}

if (thread != null && thread.LineNumber != -1)
{
await editorService.OpenDiff(session, RelativePath, thread);
}
}
catch (Exception)
catch (Exception e)
{
// TODO: Show error.
log.Error(e, nameof(DoOpen));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class RepositoryPublishViewModel : RepositoryFormViewModel, IRepositoryPu
readonly IModelServiceFactory modelServiceFactory;
readonly ObservableAsPropertyHelper<IReadOnlyList<IAccount>> accounts;
readonly ObservableAsPropertyHelper<bool> isHostComboBoxVisible;
readonly ObservableAsPropertyHelper<string> title;
readonly IUsageTracker usageTracker;

[ImportingConstructor]
Expand All @@ -52,14 +51,6 @@ public RepositoryPublishViewModel(
this.usageTracker = usageTracker;
this.modelServiceFactory = modelServiceFactory;

title = this.WhenAny(
x => x.SelectedConnection,
x => x.Value != null ?
string.Format(CultureInfo.CurrentCulture, Resources.PublishToTitle, x.Value.HostAddress.Title) :
Resources.PublishTitle
)
.ToProperty(this, x => x.Title);

Connections = connectionManager.Connections;
this.repositoryPublishService = repositoryPublishService;

Expand Down Expand Up @@ -109,8 +100,6 @@ public RepositoryPublishViewModel(
});
}

public string Title { get { return title.Value; } }

public ReactiveCommand<Unit, ProgressState> PublishRepository { get; private set; }
public IReadOnlyObservableCollection<IConnection> Connections { get; private set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public IReadOnlyList<IInlineCommentThreadModel> BuildCommentThreads(
relativePath = relativePath.Replace("\\", "/");

var threadsByPosition = pullRequest.Threads
.Where(x => x.Path == relativePath && !x.IsOutdated)
.Where(x => x.Path == relativePath)
.OrderBy(x => x.Id)
.GroupBy(x => Tuple.Create(x.OriginalCommitSha, x.OriginalPosition));
var threads = new List<IInlineCommentThreadModel>();
Expand Down
45 changes: 0 additions & 45 deletions src/GitHub.Resources/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 36 additions & 18 deletions src/GitHub.Resources/Resources.cs-CZ.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@
<data name="BrowseForDirectory" xml:space="preserve">
<value>Vyberte nadřazenou složku pro nové úložiště.</value>
</data>
<data name="CloneTitle" xml:space="preserve">
<value>Klonovat úložiště</value>
</data>
<data name="OpenFromGitHubTitle" xml:space="preserve">
<value>Otevřít z GitHubu</value>
</data>
Expand Down Expand Up @@ -168,12 +165,6 @@
<data name="PRCreatedUpstream" xml:space="preserve">
<value>Žádost o přijetí změn pro větev **{0}** se úspěšně vytvořila v [{1}]({2})</value>
</data>
<data name="PublishTitle" xml:space="preserve">
<value>Publikovat úložiště</value>
</data>
<data name="PublishToTitle" xml:space="preserve">
<value>Publikovat úložiště na {0}</value>
</data>
<data name="PullRequestCreationTitleValidatorEmpty" xml:space="preserve">
<value>Zadejte prosím název žádosti o přijetí změn.</value>
</data>
Expand All @@ -183,9 +174,6 @@
<data name="PullRequestSourceBranchDoesNotExist" xml:space="preserve">
<value>Zdrojová větev neexistuje vzdáleně, nasdíleli jste ji?</value>
</data>
<data name="RepositoryCloneFailedNoSelectedRepo" xml:space="preserve">
<value>Není vybrané žádné úložiště.</value>
</data>
<data name="RepositoryCreationClonePathEmpty" xml:space="preserve">
<value>Zadejte prosím cestu k úložišti.</value>
</data>
Expand Down Expand Up @@ -256,10 +244,10 @@
<value>Před nasdílením změn musíte napřed přijmout změny.</value>
</data>
<data name="NoCommitsToPull" xml:space="preserve">
<value>Žádná potvrzení k přijetí</value>
<value>Žádné zápisy k přijetí</value>
</data>
<data name="NoCommitsToPush" xml:space="preserve">
<value>Žádná potvrzení k nasdílení</value>
<value>Žádné zápisy k nasdílení</value>
</data>
<data name="NoDescriptionProvidedMarkdown" xml:space="preserve">
<value>*Není zadaný žádný popis.*</value>
Expand All @@ -286,7 +274,7 @@
<value>Úložiště zdrojového kódu už není k dispozici.</value>
</data>
<data name="WorkingDirectoryHasUncommittedCHanges" xml:space="preserve">
<value>Nelze rezervovat, protože pracovní adresář obsahuje nepotvrzené změny.</value>
<value>Nelze rezervovat, protože pracovní adresář obsahuje nezapsané změny.</value>
</data>
<data name="SyncSubmodules" xml:space="preserve">
<value>Synchronizovat dílčí moduly {0}</value>
Expand Down Expand Up @@ -406,7 +394,7 @@ https://git-scm.com/download/win</value>
<value>Otevřít v prohlížeči</value>
</data>
<data name="CancelLink" xml:space="preserve">
<value>Storno</value>
<value>Zrušit</value>
</data>
<data name="gistCreatedMessage" xml:space="preserve">
<value>Gist se vytvořil.</value>
Expand Down Expand Up @@ -687,7 +675,7 @@ https://git-scm.com/download/win</value>
<value>Zahájit revizi</value>
</data>
<data name="YouMustCommitAndPushYourChangesToAddACommentHere" xml:space="preserve">
<value>Pokud sem chcete přidat komentář, musíte potvrdit a nasdílet změny.</value>
<value>Pokud sem chcete přidat komentář, musíte zapsat a nasdílet změny.</value>
</data>
<data name="PreviousComment" xml:space="preserve">
<value>Předchozí komentář</value>
Expand Down Expand Up @@ -807,7 +795,7 @@ https://git-scm.com/download/win</value>
<value>Není k dispozici žádné aktivní úložiště, do kterého by bylo možné přejít.</value>
</data>
<data name="ChangesInWorkingDirectoryMessage" xml:space="preserve">
<value>Pracovní soubor je jiný než soubor v {0}. Rezervujte si prosím odpovídající větev, žádost o přijetí změn nebo potvrzení.</value>
<value>Pracovní soubor je jiný než soubor v {0}. Rezervujte si prosím odpovídající větev, žádost o přijetí změn nebo zápis.</value>
</data>
<data name="DifferentRepositoryMessage" xml:space="preserve">
<value>Otevřete prosím úložiště {0} a zkuste to znovu.</value>
Expand Down Expand Up @@ -848,4 +836,34 @@ https://git-scm.com/download/win</value>
<data name="MostRecentlyPushed" xml:space="preserve">
<value>{0} – naposledy nasdíleno</value>
</data>
<data name="Comment" xml:space="preserve">
<value>Komentář</value>
</data>
<data name="ClosePullRequest" xml:space="preserve">
<value>Zavřít žádost o přijetí změn</value>
</data>
<data name="CloseIssue" xml:space="preserve">
<value>Zavřít problém</value>
</data>
<data name="CloseAndComment" xml:space="preserve">
<value>Zavřít a okomentovat</value>
</data>
<data name="ReopenAndComment" xml:space="preserve">
<value>Znovu otevřít a okomentovat</value>
</data>
<data name="ReopenIssue" xml:space="preserve">
<value>Znovu otevřít problém</value>
</data>
<data name="ReopenPullRequest" xml:space="preserve">
<value>Znovu otevřít žádost o přijetí změn</value>
</data>
<data name="CommitCountFormat" xml:space="preserve">
<value>{0} – potvrzení</value>
</data>
<data name="AddedSomeCommits" xml:space="preserve">
<value>přidala se nějaká potvrzení</value>
</data>
<data name="AndOthers" xml:space="preserve">
<value>a další</value>
</data>
</root>
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0