Skip to content
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

Move more code over to ProducerConsumer model. #73324

Merged
merged 13 commits into from
May 3, 2024

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented May 3, 2024

Followup to #73323.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels May 3, 2024
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review May 3, 2024 16:29
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner May 3, 2024 16:29
@CyrusNajmabadi CyrusNajmabadi requested a review from ToddGrun May 3, 2024 16:29
@@ -120,14 +120,15 @@ private static void ClearCachedData()

// Sort the groups into a high pri group (projects that contain a high-pri doc), and low pri groups (those that
// don't), and process in that order.
await PerformParallelSearchAsync(
await ProducerConsumer<RoslynNavigateToItem>.RunParallelAsync(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inlined as requested :)

@@ -101,7 +101,7 @@ private static void ClearCachedData()
ImmutableArray<DocumentKey> priorityDocumentKeys,
string searchPattern,
IImmutableSet<string> kinds,
Func<ImmutableArray<RoslynNavigateToItem>, Task> onItemsFound,
Func<ImmutableArray<RoslynNavigateToItem>, VoidResult, CancellationToken, Task> onItemsFound,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need the VoidResult for the 'args'. we don't actually end up needing any args ourselves, so this is how we just indicate it's unused.

also, i found that things wer ecleaner if i made it so that 'cancellation' was consistently passed along as an actual arg to the lambdas, instead of needing to package it in the 'args' parameter.

/// <code>Parallel.ForEachAsync</code>, allowing for parallel processing of the items, with a preference towards
/// earlier items.
/// </summary>
private static Task PerformParallelSearchAsync<T>(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed. inlined in the 3 places that use it.

@@ -94,19 +111,6 @@ internal static partial class FixAllContextHelper
return await GetDocumentDiagnosticsToFixAsync(
fixAllContext.Solution, allDiagnostics, fixAllContext.CancellationToken).ConfigureAwait(false);

async Task AddDocumentDiagnosticsAsync(ConcurrentDictionary<ProjectId, ImmutableArray<Diagnostic>> diagnostics, Project projectToFix)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inlined.

}
await foreach (var (project, diagnostics) in results)
{
if (diagnostics.Any())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (diagnostics.Any())

nit: might make more sense to filter this on the producer side

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed. can do in followup.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@CyrusNajmabadi CyrusNajmabadi enabled auto-merge May 3, 2024 17:03
@CyrusNajmabadi CyrusNajmabadi merged commit 6128e20 into dotnet:main May 3, 2024
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone May 3, 2024
@CyrusNajmabadi CyrusNajmabadi deleted the taskWhenAll branch May 3, 2024 18:11
@CyrusNajmabadi
Copy link
Member Author

@jasonmalinowski For review when you get back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants