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

Consider changing some internal services to singletons #129

Open
nfroidure opened this issue Aug 16, 2023 · 1 comment
Open

Consider changing some internal services to singletons #129

nfroidure opened this issue Aug 16, 2023 · 1 comment

Comments

@nfroidure
Copy link
Owner

Some services, like $fatalError should probably be singletons since they concern the processes (its only use is atm here:
https://github.com/nfroidure/common-services/blob/main/src/process.ts#L84-L88

Some other ain't that simple to determine INJECTOR and SILO_CONTEXT are not singletons and it looks difficult to change their nature:

knifecycle/src/index.ts

Lines 397 to 398 in 86a34ca

// TEMPFIX: Fatal Errors are global
![FATAL_ERROR, INJECTOR, SILO_CONTEXT].includes(serviceName) &&

Maybe that the autoloader itself should not be a singleton and be tied to its silo context? That said since initializers are the same for all silos, the autoloader would be a singleton that finally load the same things for each silos? Weird... Or not?

Have to think about it more, let's not include it into the v16.

@nfroidure
Copy link
Owner Author

$fatalError is now a singleton and a separate file in the codebase https://github.com/nfroidure/knifecycle/blob/main/src/fatalError.ts#L56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant