-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Dependencies, Performance
Motivation
We want to move the import (requiring) of dependencies into the part of the driver that utilizes the feature that the extension offers. Other than FLE, we currently have all our dependencies set up for lazy usage but not lazy import. FLE's import occurs when the autoEncrypter options are specified on a MongoClient. Example: I should be able to assert that if I do not enable AWS authentication that the AWS peerOptionalDependency the driver needs for this auth is not attempted to be imported.
- Less code imported at start up is better for start up time performance
- Unused code isn't residing in memory just because the dependency exists on disk
AC
- Make Snappy lazy loaded
- Have a helper resolve or reject async based on the dependency presence
- Update the usages of makeErrorModule and its assoc. cached variable
- when the dependency is not present but the feature is attempted to be used users should still get a MongoMissingDependencyError
- Add unit tests for makeErrorModule
Test AC
- Use unit tests to verify that importing the driver only imports expected non-lazy deps
Follow up
- update other dep investigation tickets with AC relating to adding lazy loading (socks, saslprep, aws4)
- is related to
-
MONGOSH-1399 Add snapshot support test to the Node.js driver
- Closed
- related to
-
NODE-4829 Spike: investigate best way to handle optional 3rd party dependencies
- Closed
-
NODE-5008 Add kerberos and zstd to the list of peer optional dependencies
- Closed
-
NODE-5006 Investigate saslprep being an optional dependency
- Closed
-
NODE-5007 Investigate making socks an optional peer dependency
- Closed
-
NODE-5005 Investigate the need for aws4 [non-breaking]
- Closed
-
NODE-5289 Handle saslprep require not returning function
- Closed