Skip to content

Commit

Permalink
fix(connection): handle direct connection to uninitialized replica se…
Browse files Browse the repository at this point in the history
…t that then becomes initialized

Fix #10948
  • Loading branch information
vkarpov15 committed Dec 5, 2021
1 parent be16016 commit 7b0ae33
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -850,10 +850,10 @@ function _setClient(conn, client, options, dbName) {
if (type === 'Single') {
client.on('serverDescriptionChanged', ev => {
const newDescription = ev.newDescription;
if (newDescription.type === 'Standalone') {
_handleReconnect();
} else {
if (newDescription.type === 'Unknown') {
conn.readyState = STATES.disconnected;
} else {
_handleReconnect();
}
});
} else if (type.startsWith('ReplicaSet')) {
Expand Down

0 comments on commit 7b0ae33

Please sign in to comment.