Skip to content

Commit 28969a7

Browse files
committed
PYTHON-1407 Ignore non-readable servers' session timeout.
1 parent a4f58cc commit 28969a7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pymongo/topology_description.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ def __init__(self,
9595
# of known ServerType. If any ServerDescription of known ServerType has
9696
# a null logicalSessionTimeoutMinutes, then
9797
# TopologyDescription.logicalSessionTimeoutMinutes MUST be set to null.
98-
known = self.known_servers
99-
if not known:
98+
readable = [s for s in self.known_servers if s.is_readable]
99+
if not readable:
100100
self._ls_timeout_minutes = None
101-
elif any(s.logical_session_timeout_minutes is None for s in known):
101+
elif any(s.logical_session_timeout_minutes is None for s in readable):
102102
self._ls_timeout_minutes = None
103103
else:
104104
self._ls_timeout_minutes = min(s.logical_session_timeout_minutes
105-
for s in known)
105+
for s in readable)
106106

107107
def check_compatible(self):
108108
"""Raise ConfigurationError if any server is incompatible.

0 commit comments

Comments
 (0)