Skip to content

Commit 81b93a2

Browse files
committed
PYTHON-1141 - Always publish failed event when heartbeats fail
1 parent f9aecf1 commit 81b93a2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pymongo/monitor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ def _check_with_retry(self):
126126
raise
127127
except Exception as error:
128128
error_time = _time() - start
129+
if self._publish:
130+
self._listeners.publish_server_heartbeat_failed(
131+
address, error_time, error)
129132
self._topology.reset_pool(address)
130133
default = ServerDescription(address, error=error)
131134
if not retry:
132-
if self._publish:
133-
self._listeners.publish_server_heartbeat_failed(
134-
address, error_time, error)
135135
self._avg_round_trip_time.reset()
136136
# Server type defaults to Unknown.
137137
return default

0 commit comments

Comments
 (0)