-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: allow connect again after close #2355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
0136cd1
835f0aa
3be1b95
865d8b5
854c72f
5043ca3
5763728
c4eb0fa
32c1ce8
dafab24
caf581e
414e091
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -260,6 +260,18 @@ function connect(mongoClient, url, options, callback) { | |
| throw new Error('no callback function provided'); | ||
| } | ||
|
|
||
| // Has a connection already been established? | ||
| if (mongoClient.topology) { | ||
| if (mongoClient.topology.isConnected()) { | ||
| throw new Error('already connected'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this error message can be improved |
||
| } | ||
| // this is a reconnect, clear out old state | ||
|
emadum marked this conversation as resolved.
Outdated
|
||
| mongoClient.topology = undefined; | ||
| mongoClient.s.options = {}; | ||
| mongoClient.s.dbCache = new Map(); | ||
| mongoClient.s.sessions = new Set(); | ||
| } | ||
|
|
||
| let didRequestAuthentication = false; | ||
| const logger = Logger('MongoClient', options); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,7 +68,7 @@ | |
| "test": "npm run lint && mocha --recursive test/functional test/unit test/core", | ||
| "test-nolint": "mocha --recursive test/functional test/unit test/core", | ||
| "coverage": "istanbul cover mongodb-test-runner -- -t 60000 test/core test/unit test/functional", | ||
| "lint": "eslint lib test", | ||
| "lint": "eslint -v && eslint lib test", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated to this PR. I just sometimes get weird discrepancies between running |
||
| "format": "prettier --print-width 100 --tab-width 2 --single-quote --write 'test/**/*.js' 'lib/**/*.js'", | ||
| "bench": "node test/benchmarks/driverBench/", | ||
| "generate-evergreen": "node .evergreen/generate_evergreen_tasks.js", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I upgraded
nvmso we can use the newish--no-progressoption.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh very nice 👏