-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Switch OnAfterPackageLoadedAsync to use a TaskQueue #77687
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
Switch OnAfterPackageLoadedAsync to use a TaskQueue #77687
Conversation
This changes it's behavior to be exactly like InitializeAsync in that it uses this mechanism to minimze thread switches. Also: 1) Renamed PackageRegistrationTasks to PackageLoadTasks 2) Removed the IProgress paramater as it wasn't used and doesn't fit well with OnAfterPackageLoadedAsync 3) Moved service broker service proffering to background thread
| } | ||
|
|
||
| public void RegisterInitializationWork(PackageRegistrationTasks packageRegistrationTasks) | ||
| public void RegisterInitializationWork(PackageLoadTasks packageInitializationTasks) |
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.
| public void RegisterInitializationWork(PackageLoadTasks packageInitializationTasks) | |
| public void RegisterInitializationWork(PackageLoadTasks packageLoadTasks) |
Maybe just to keep the naming consistent? Although I kinda like PackageInitializationTasks too...
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 tried to be consistent and keep all the RegisterInitializeAsyncWork method parameters to be named packageInitializationTasks and the RegisterOnAfterPackageLoadedAsyncWork parameters to be afterPackageLoadedTasks.
| // Ensure the options persisters are loaded since we have to fetch options from the shell | ||
| LoadOptionPersistersAsync(this.ComponentModel, cancellationToken).Forget(); |
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 is still hopping back to the main thread for the PackageSettingsPersister, right? Will that cause any problems? I don't imagine so since you're still doing a JTF friendly await but I don't imagine we risk deadlock, right?
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 you point me to the main thread switch you're mentioning.
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.
Oh never mind I was wrong it doesn't exist.
| packageInitializationTasks.AddTask( | ||
| isMainThreadTask:=False, | ||
| task:=Function(progress, packageRegistrationTasks2, cancellationToken) As Task | ||
| task:=Function(packageInitializationTasks2, cancellationToken) As Task |
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.
Given the local you're calling this on is always in scope, do you really ever need this function param? We're not using static lambdas....
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'm not a VB expert, I just type until something compiles for it. What's the suggested change?
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.
Just delete the lambda parameter entirely in the function signature; it's already available as a local at all call sites so you're just making more typing generally.
This changes it's behavior to be exactly like InitializeAsync in that it uses this mechanism to minimze thread switches.
Also: