-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serialize submodules info loading #6372
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6372 +/- ##
=========================================
+ Coverage 46.63% 46.8% +0.17%
=========================================
Files 687 688 +1
Lines 51666 51927 +261
Branches 6807 6826 +19
=========================================
+ Hits 24096 24306 +210
- Misses 26262 26280 +18
- Partials 1308 1341 +33
|
Encoding outputEncoding = null, | ||
bool stripAnsiEscapeCodes = true) | ||
{ | ||
var result = await executable.ExecuteAsync(arguments, writeInput, outputEncoding, stripAnsiEscapeCodes); |
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.
It is not an async stream, but at least is non blocking.
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.
What kind of stream is it? What would it take to make it properly asynchronous?
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.
Thanks! |
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.
For c62d4f9, I prefer #6359 instead
There are quite some changes otherwise, mostly seem fine. I would like to see the outcome of the discussion in #6357 (comment) before merging.
👍
Even if we go for a dedicated task scheduler for background tasks, running tens of background tasks simultaneously will degrade the overall system performance. |
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.
👍
{ | ||
var args = new GitArgumentBuilder("show") { $"HEAD:{path.ToPosixPath().Quote()}" }; | ||
var result = _gitExecutable.Execute(args); | ||
var result = await _gitExecutable.ExecuteAsync(args).ConfigureAwaitRunInline(); |
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.
Could you please explain how you chose when to use ConfigureAwaitRunInline()
and when ConfigureAwait(false)
calls?
I've found microsoft/vs-threading#292 (via dotnet/project-system#3662), however it is not clear to me why we aren't using one or the other.
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 use ConfigureAwait(false)
when I don't want the continuation to be executed on the main thread.
I use ConfigureAwaitRunInline
when I know it is safe to continue on the thread that completed the awaited task (regarding both: accessing variables and continuation's duration time).
Thank you
…On Wed, 20 Mar 2019 at 01:08, Janusz Białobrzewski ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In GitCommands/Git/GitModule.cs
<#6372 (comment)>
:
> {
var args = new GitArgumentBuilder("show") { $"HEAD:{path.ToPosixPath().Quote()}" };
- var result = _gitExecutable.Execute(args);
+ var result = await _gitExecutable.ExecuteAsync(args).ConfigureAwaitRunInline();
I use ConfigureAwait(false) when I don't want the continuation to be
executed on the main thread.
I use ConfigureAwaitRunInline when I know it is safe to continue on the
thread that completed the awaited task (regarding both: accessing variables
and continuation's duration time).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6372 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEMyXkeGrpF4k78nkqtZHOIoVR_ZndNtks5vYO9OgaJpZM4b31Pk>
.
|
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.
LGTM, but I don't work with any repos with submodules (except the GE), so have no real opinion.
If there is too many submodules, then too many tasks are spawned causing delays in getting async output.
then refresh all items at once with a single switch to the main thread
How to continue this? This PR goes after the core problem even if there may be some issues left. From what I can tell, the changes are improvements anyway. Should this be merged anyway? @jbialobr @RussKie I rebased and removed one change in c62d4f9 (rest of the commit is probably OK): There are other ways to limit job (#6373 to minor extent, some suggestions in #5369) too, but that will not handle situations with many submodule changes. |
I don't currently work with any repos that have submodules (other than GE), so I have no skin in the game. If you're happy with the changes, let's merge them. |
There are roughly three parts to this PR (partly from the PR description):
Good from what I know about async handling, but I am not the expert here, the existing GE code is my reference. If I were the maintainer, I would have squash merged these commits.
Not needed after #6359. At least one line should be removed, maybe the other are an improvement.
Probably OK change, no need to make massive starts of background requests. @jbialobr @sharwell @drewnoakes @spdr870 @RussKie |
I see no value in squashing commits. It was already discussed.
It is no longer a part of this PR.
In my opinion this change is not needed only if we implement refreshing those submodules which actually have changed. Otherwise querying for all the submodules at once puts an unnecessary pressure on the system resources. |
(char code, ObjectId commitId) = moduleSub.GetSuperprojectCurrentCheckout(); | ||
Assert.AreEqual(32, code); | ||
Assert.AreEqual(commitRef, commitId.ToString()); | ||
ThreadHelper.JoinableTaskFactory.Run(async () => |
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.
💡 Can we just make the containing test method asynchronous?
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 know. Is doing so compatible with JTF?
… we have to recheck if cancellation was requested. Co-Authored-By: jbialobr <jbialobr@o2.pl>
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.
Thanks. Lets merge this!
I am updating to only request submodule status for trees with changes which also will serialize requests, but this is not in conflict with this PR
var cmd = GitCommandHelpers.GetAllChangedFilesCmd(true, UntrackedFilesMode.Default, | ||
noLocks: true); | ||
var output = module.GitExecutable.GetOutput(cmd); | ||
var output = await module.GitExecutable.GetOutputAsync(cmd).ConfigureAwait(false); |
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.
This change causes git-status to run on the UI thread. Is this really necessary?
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.
Do you observe any issues related to this? This is an async call and does not block the UI.
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.
No problem seem, just confused by it.
Fixes #6357
Proposed changes
Screenshots
Before
After
Test methodology
✒️ I contribute this code under The Developer Certificate of Origin.