File tree Expand file tree Collapse file tree 2 files changed +2
-3
lines changed Expand file tree Collapse file tree 2 files changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ PyMongo 4.14 brings a number of changes including:
1010- Added :meth: `pymongo.asynchronous.mongo_client.AsyncMongoClient.append_metadata ` and
1111 :meth: `pymongo.mongo_client.MongoClient.append_metadata ` to allow instantiated MongoClients to send client metadata
1212 on-demand
13+ - Improved performance of selecting a server with the Primary selector.
1314
1415- Introduces a minor breaking change. When encoding :class: `bson.binary.BinaryVector `, a ``ValueError `` will be raised
1516 if the 'padding' metadata field is < 0 or > 7, or non-zero for any type other than PACKED_BIT.
Original file line number Diff line number Diff line change @@ -325,9 +325,7 @@ def apply_selector(
325325 return [description ] if description else []
326326
327327 # Primary selection fast path.
328- if self .topology_type == TOPOLOGY_TYPE .ReplicaSetWithPrimary and isinstance (
329- selector , Primary
330- ):
328+ if self .topology_type == TOPOLOGY_TYPE .ReplicaSetWithPrimary and type (selector ) is Primary :
331329 for sd in self ._server_descriptions .values ():
332330 if sd .server_type == SERVER_TYPE .RSPrimary :
333331 return [sd ]
You can’t perform that action at this time.
0 commit comments