Skip to content

Commit cbab615

Browse files
authored
PYTHON-3065 Ignore SRV polling update when topology is discovered to be a replica set (#943)
1 parent 21ead3a commit cbab615

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

pymongo/topology.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ def _process_srv_update(self, seedlist):
358358
Hold the lock when calling this.
359359
"""
360360
td_old = self._description
361+
if td_old.topology_type not in SRV_POLLING_TOPOLOGIES:
362+
return
361363
self._description = _updated_topology_description_srv_polling(self._description, seedlist)
362364

363365
self._update_servers()

pymongo/topology_description.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ def _updated_topology_description_srv_polling(topology_description, seedlist):
477477
- `seedlist`: a list of new seeds new ServerDescription that resulted from
478478
a hello call
479479
"""
480+
assert topology_description.topology_type in SRV_POLLING_TOPOLOGIES
480481
# Create a copy of the server descriptions.
481482
sds = topology_description.server_descriptions()
482483

0 commit comments

Comments
 (0)