If establishing a database connection is slow
and database migration runs and there are many
models, sql operations are queued up and this
leads to the node.js max emitters exceeded
warning.
A default value for max emitters has now
been introduced, and it can also be configured
in datasources.json.
Co-authored-by: Dominique Emond <dremond@ca.ibm.com>
Use case:
1. Configure a datasource with lazyConnect = true
2. Do NOT start the DB
3. Start the app
4. Send first request and it fails to connnect to the DB
5. Start the DB
5. Requests are now served correctly
Add API allowing consumers (e.g. LoopBack) to remove a Model from all
juggler registries:
- ModelBuilder's models
- ModelBuilder's definitions
- Connector registry of models
Before this change, when resolving full connector path, all errors were
ignored. As a result, when the connector was installed but not
correctly built (e.g. loopback-connector-db2 which uses a native addon),
a very confusing message was reported by LoopBack.
In this commit, I am fixing the code handling `require()` errors
to ignore only MODULE_NOT_FOUND errors that contain the name
of the required module.