-
Notifications
You must be signed in to change notification settings - Fork 4.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
Move more code over to producer/consumer model #73331
Conversation
/// Version of RunAsync that will process <paramref name="source"/> in parallel. | ||
/// </summary> | ||
public static Task RunParallelAsync<TSource, TArgs>( | ||
IAsyncEnumerable<TSource> source, |
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 overload operates on an IAsyncEnumerable source. I can't find ways to make these overloads without a lot of duplication of the bodies unfortunately.
{ | ||
return Documents.Concat(await GetSourceGeneratedDocumentsAsync(cancellationToken).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.
old approach blocked the caller until SG docs were generated. New approach allows the actual docs to be returned first.
src/Features/Core/Portable/Completion/Providers/AbstractSymbolCompletionProvider.cs
Outdated
Show resolved
Hide resolved
@ToddGrun Second to last one of these. I only have one more change i want to make in this area. |
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionBatchFixAllProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionBatchFixAllProvider.cs
Show resolved
Hide resolved
src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionBatchFixAllProvider.cs
Outdated
Show resolved
Hide resolved
@@ -130,7 +130,10 @@ public static Generator CreateAndWriteCapabilitiesVertex(ILsifJsonWriter lsifJso | |||
} | |||
}; | |||
|
|||
var documents = (await project.GetAllRegularAndSourceGeneratedDocumentsAsync(cancellationToken)).ToList(); | |||
var documents = new List<Document>(); |
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.
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. i just needed to update this code because GetAllRegularAndSourceGeneratedDocumentsAsync now returns an IAsyncEnumerable.
} | ||
using var _ = ArrayBuilder<Diagnostic>.GetInstance(out var diagnostics); | ||
await ProducerConsumer<Diagnostic>.RunParallelAsync( | ||
source: project.GetAllRegularAndSourceGeneratedDocumentsAsync(cancellationToken), |
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.
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.
yep, this is better.
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.
@jasonmalinowski For review when you get back. |
No description provided.