-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
Make eager service registration explicit and revisit existing one #159178
Comments
@sandy081 starting with you because many of your services show as eager |
* #159178 make service instantiation lazy * add comment * update comment * make comment clear about cyclic dep * :lisptick:
@jrieken adopted those service I own |
@bpasero you are next :-) |
Went over the ones I consider owning and found some that can be lazy: #159899 Some observations:
|
Also did #159972 which forces every remote service (i.e. a service that talks to the main process or shared process) to be lazy. All of these services did already declare laziness but now its just enabled by default. |
I like - I'll add another falsy value like "eager" or so |
* Address #159178 for notebooks * Add method to list editor decorations so they can be initialized in the lazy instantiated NotebookService
Thanks everyone! |
The
registerSingleton
-function supports asupportsDelayedInstantiation
-argument.With
InstantiationType.Delayed
only proxies of services are injected and the actual instantiation happens in "slack/idle" time or at time of first actual use (whatever comes first). This is often overlooked and the default (false
, eager) is used. This issue is about:InstantiationType.Eager
, and feel a little bad about it 😳Note that
Eager
should only be needed if your service is doing something "by its own", like reading files or so, which is vital to other parts of the system. This should be the exception because most services offer something (a service) to others which means can be delayed until neededThe text was updated successfully, but these errors were encountered: