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(
1344
1344
# always send primaryPreferred when directly connected to a repl set
1345
1345
# member.
1346
1346
# 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
1349
1350
1350
1351
with self ._checkout (server , session ) as conn :
1351
1352
if single :
@@ -1365,7 +1366,6 @@ def _conn_for_reads(
1365
1366
operation : str ,
1366
1367
) -> ContextManager [tuple [Connection , _ServerMode ]]:
1367
1368
assert read_preference is not None , "read_preference must not be None"
1368
- _ = self ._get_topology ()
1369
1369
server = self ._select_server (read_preference , session , operation )
1370
1370
return self ._conn_from_server (read_preference , server , session )
1371
1371
You can’t perform that action at this time.
0 commit comments