Skip to content

PYTHON-5821 - Fix ordering issue between event publish and logging fo…#2867

Open
NoahStapp wants to merge 1 commit into
mongodb:masterfrom
NoahStapp:PYTHON-5821-1
Open

PYTHON-5821 - Fix ordering issue between event publish and logging fo…#2867
NoahStapp wants to merge 1 commit into
mongodb:masterfrom
NoahStapp:PYTHON-5821-1

Conversation

@NoahStapp

Copy link
Copy Markdown
Contributor

…r connection creation and ready

PYTHON-5821

Changes in this PR

Follow-up to #2796 that fixes the same issue for connection creation and ready events/logs.

Test Plan

Existing tests.

Checklist

Checklist for Author

  • [ ] Did you update the changelog (if necessary)?
  • Is there test coverage?
  • [ ] Is any followup work tracked in a JIRA ticket? If so, add link(s).

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

Copilot AI review requested due to automatic review settings June 11, 2026 16:08
@NoahStapp NoahStapp requested a review from a team as a code owner June 11, 2026 16:08
@NoahStapp NoahStapp requested a review from sleepyStick June 11, 2026 16:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a race/ordering issue between CMAP event publication and connection-related debug logging by ensuring the debug log is emitted before publishing the corresponding CMAP events for connection creation and connection ready. This is a follow-up to #2796, extending the same ordering guarantee to additional connection lifecycle points.

Changes:

  • Reordered connection_created emission to occur after the corresponding CONN_CREATED debug log.
  • Reordered connection_ready emission to occur after the corresponding CONN_READY debug log.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pymongo/synchronous/pool.py Reorders connection created/ready CMAP event publication to occur after debug logging.
pymongo/asynchronous/pool.py Reorders connection created/ready CMAP event publication to occur after debug logging (async pool).

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants