Shorten extension activation time by not unnecessarily awaiting async tasks within ExtensionSingleActivationServices
See original GitHub issue_Originally posted by @DonJayamanne in https://github.com/microsoft/vscode-jupyter/pull/11572#discussion_r990499647_
this blocks the loading of the extension, can this be done in the background,
all of the activate methods run when extension loads and we wait for all of them to complete.
i would suggest using the IExtensionSync.... interface
I didn’t realize that there is an IExtensionSyncActivationService
which doesn’t block (await
for long running tasks), and should be used whenever possible.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Async/Await - Best Practices in Asynchronous Programming
An approach I like to take is to minimize the code in my asynchronous event handler—for example, have it await an async Task...
Read more >Long Story Short: Async/Await Best Practices in .NET - Medium
The only time we truly want to await is when we do something with the result of the async task in the continuation...
Read more >Using Task.Run in Conjunction with Async/Await | Pluralsight
So let's explore using Task.Run in conjunction with async/await . It's not difficult to use, but as we shall see, knowing when its...
Read more >How to safely call an async method in C# without await
If you want to get the exception "asynchronously", you could do: MyAsyncMethod(). ContinueWith(t => Console.WriteLine(t.
Read more >Improving Your Asynchronous Code Using Tasks, Async and ...
Dave Marini delves into the history of asynchronous programming on the . ... If the modifier is not present, await cannot be called...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maybe a better title would be “Shorten extension activation time by not unnecessarily awaiting async tasks within
ExtensionSingleActivationService
s” ?The blocking I’m referring to is any
await
happen inExtensionSingleActivationService#activate
will block the whole extension to be activated. A synchronous task will do the same, but if you have anasync
task but you kick off inIExtensionSyncActivationService#activate
, we at least make sure that it’s a fire-and-forget, instead of holding off the extension activation process.What @DonJayamanne put here is very accurate and they are the rules we want to follow.
https://github.com/microsoft/vscode-jupyter/blob/main/src/kernels/jupyter/finder/universalRemoteKernelFinderController.ts#L57 is a good example, ideally the remote kernel finder is Push Model and register kernels when it finds remote uris, but currently it’s blocking the activation.