Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PYTHON-3490 CMAP connection establishment failure tests #1160

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PYTHON-3490 Push down SDAM connection error handling into the Pool ch…
…eckout process
  • Loading branch information
ShaneHarvey committed Feb 17, 2023
commit 2c56051257a45e00ce94625f74fe3a7c3b2d2103
6 changes: 5 additions & 1 deletion pymongo/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,8 @@ def connect(self, handler=None):
try:
sock = _configured_socket(self.address, self.opts)
except BaseException as error:
if handler:
handler.handle(type(error), error)
if self.enabled_for_cmap:
listeners.publish_connection_closed(
self.address, conn_id, ConnectionClosedReason.ERROR
Expand All @@ -1376,7 +1378,9 @@ def connect(self, handler=None):
handler.contribute_socket(sock_info, completed_handshake=False)

sock_info.authenticate()
except BaseException:
except BaseException as error:
if handler:
handler.handle(type(error), error)
sock_info.close_socket(ConnectionClosedReason.ERROR)
raise

Expand Down