File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1344,8 +1344,9 @@ def _conn_from_server(
13441344 # always send primaryPreferred when directly connected to a repl set
13451345 # member.
13461346 # Thread safe: if the type is single it cannot change.
1347- topology = self ._get_topology ()
1348- single = topology .description .topology_type == TOPOLOGY_TYPE .Single
1347+ # NOTE: We already opened the Topology when selecting a server so there's no need
1348+ # to call _get_topology() again.
1349+ single = self ._topology .description .topology_type == TOPOLOGY_TYPE .Single
13491350
13501351 with self ._checkout (server , session ) as conn :
13511352 if single :
@@ -1365,7 +1366,6 @@ def _conn_for_reads(
13651366 operation : str ,
13661367 ) -> ContextManager [tuple [Connection , _ServerMode ]]:
13671368 assert read_preference is not None , "read_preference must not be None"
1368- _ = self ._get_topology ()
13691369 server = self ._select_server (read_preference , session , operation )
13701370 return self ._conn_from_server (read_preference , server , session )
13711371
You can’t perform that action at this time.
0 commit comments