Skip to content

Commit f32a3a6

Browse files
committed
PYTHON-4780 Implement fast path for server selection with Primary
1 parent ac12b55 commit f32a3a6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pymongo/topology_description.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from bson.objectid import ObjectId
3535
from pymongo import common
3636
from pymongo.errors import ConfigurationError, PyMongoError
37-
from pymongo.read_preferences import ReadPreference, _AggWritePref, _ServerMode
37+
from pymongo.read_preferences import Primary, ReadPreference, _AggWritePref, _ServerMode
3838
from pymongo.server_description import ServerDescription
3939
from pymongo.server_selectors import Selection
4040
from pymongo.server_type import SERVER_TYPE
@@ -326,7 +326,7 @@ def apply_selector(
326326

327327
# Primary selection fast path.
328328
if self.topology_type == TOPOLOGY_TYPE.ReplicaSetWithPrimary and isinstance(
329-
selector, TOPOLOGY_TYPE.Primary
329+
selector, Primary
330330
):
331331
for sd in self._server_descriptions.values():
332332
if sd.server_type == SERVER_TYPE.RSPrimary:

0 commit comments

Comments
 (0)