Skip to content

Consider changing some internal services to singletons #129

@nfroidure

Description

@nfroidure

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.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions