File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -431,7 +431,9 @@ def close(self):
431431
432432 # Mark all servers Unknown.
433433 self ._description = self ._description .reset ()
434- self ._update_servers ()
434+ for address , sd in self ._description .server_descriptions ().items ():
435+ if address in self ._servers :
436+ self ._servers [address ].description = sd
435437
436438 # Stop SRV polling thread.
437439 if self ._srv_monitor :
Original file line number Diff line number Diff line change @@ -743,6 +743,13 @@ def test_close_stops_kill_cursors_thread(self):
743743 client .close ()
744744 self .assertTrue (client ._kill_cursors_executor ._stopped )
745745
746+ def test_close_does_not_open_servers (self ):
747+ client = rs_client (connect = False )
748+ topology = client ._topology
749+ self .assertEqual (topology ._servers , {})
750+ client .close ()
751+ self .assertEqual (topology ._servers , {})
752+
746753 def test_bad_uri (self ):
747754 with self .assertRaises (InvalidURI ):
748755 MongoClient ("http://localhost" )
You can’t perform that action at this time.
0 commit comments