fix(cli-repl): do not wait for connectionInfo in quiet non-REPL mode MONGOSH-1765 #1962
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Do not
callwait forfetchConnectionInfo()
and similar methods when they are not needed. This hopefully improves startup performance in real-world scenarios a bit further.In order to achieve this:
ShellInstanceState
class. We now only fetch connection info here if requested, and only refresh it if the service provider instance changed (and not just the database itself).fetchConnectionInfo()
methodto only be called if we believe it to be necessary, and for its result to be awaited only if we need it immediately.This also adds type safety by removing the
any
typing forconnectionInfo
inShellInstanceState
. I admittedly thought that this would be a quick fix, but unfortunately (as seen in the commit diff), this spiraled a bit into different packages and tests as a larger change to align the typings for this object.