Fix error handler in topology.connect#1812
Merged
mbroadst merged 1 commit intomongodb:masterfrom Aug 15, 2018
Merged
Conversation
if topology.connect has an error, topology is "overwritten", changing the function parameter to a new name, let's "force close" the old instance.
Contributor
|
@simllll @mbroadst I can confirm this fixes an issue that's popping up in the Mongoose tests. I looked into it and it is a minor issue that seems to pop up when you specify the const { MongoClient } = require('mongodb');
run().catch(error => console.error(error.stack));
async function run() {
// Fails with "Cannot read property 'close' of undefined" if localhost:27017 is a standalone
await MongoClient.connect('mongodb://localhost:27017/test', { replicaSet: 'rs', useNewUrlParser: true });
}We can work around this for now |
Member
|
@vkarpov15 @simllll thanks for catching this! It's strange because it should technically be the same object, but I definitely prefer the enhanced readability. We're working diligently on a fix for the change streams resume issues, so this fix here will likely make it into a patch release this week including that and updated kerberos support. |
vkarpov15
added a commit
to Automattic/mongoose
that referenced
this pull request
Aug 16, 2018
This was referenced Aug 28, 2021
Open
This was referenced Aug 29, 2021
This was referenced Sep 5, 2021
This was referenced Sep 7, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
if topology.connect has an error, topology is "overwritten" which leads to an error like:
changing the function parameter to a new name, let's "force close" the old instance.