loopbackio / loopback-next

LoopBack makes it easy to build modern API applications that require complex integrations.
https://loopback.io
Other
4.95k stars 1.07k forks source link

Unregister runtime artifacts #2485

Closed bajtos closed 3 years ago

bajtos commented 5 years ago

When discovering & defining models at run-time (see #2484), it's often important to allow applications to remove artifacts that are no longer used.

In LoopBack 3.x, we provide the following API:

app.deleteModelByName(modelName);

The situation is more complex in LB4, because there are multiple artifacts involved in exposing a data table/collection via REST API:

Acceptance criteria

marioestradarosa commented 5 years ago

like a garbage collector?.

jannyHou commented 5 years ago

Tip: After removing the artifact, make sure the extension point also remove it from cache/rebuild the cache

e.g. Routing table watches the view of controller, make sure it refresh the cache when controller goes.

Suggestion: The scope of this story is too big, we can have a spike for all artifacts and figure out the scope of unregistering them.

bajtos commented 5 years ago

@marioestradarosa

like a garbage collector

We need to delete all references to the artifact we want to remove, so that the garbage collector can reclaim the memory used by that artifact.

in this case datasource classes that connects to the database, do they close their connections once unregistered

Yes, they should close their connections as part of the unregistering workflow.

Could you specify unregister ? unbind it?

I think that's something we need to find out, probably in a spike story.

emonddr commented 5 years ago

This should leverage the lifecycle support mentioned in : https://github.com/strongloop/loopback-next/pull/1928

dhmlau commented 5 years ago

Created https://github.com/strongloop/loopback-next/issues/2619 for the spike.

stale[bot] commented 4 years ago

This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.

stale[bot] commented 3 years ago

This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.

stale[bot] commented 3 years ago

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.