Skip to content

Conversation

@blink1073
Copy link
Member

Replaces #2598

class PyMongoBaseProtocol(Protocol):
def __init__(self, timeout: Optional[float] = None):
self.transport: Transport = None # type: ignore[assignment]
self._timeout = timeout
Copy link
Member Author

Choose a reason for hiding this comment

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

I reverted these changes from #2509 since they were unrelated

@blink1073 blink1073 marked this pull request as ready for review November 11, 2025 15:48
@blink1073 blink1073 requested a review from a team as a code owner November 11, 2025 15:48
@blink1073 blink1073 requested review from Jibola and ShaneHarvey and removed request for a team and Jibola November 11, 2025 15:48
"SystemOverloadedError"
if isinstance(error, WaitQueueTimeoutError) or (
error.has_error_label("SystemOverloadedError")
and error.has_error_label("RetryableError")
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious. Do we need to check both error labels here?

Copy link
Member Author

Choose a reason for hiding this comment

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

We're the ones adding the labels, would we want to add one but not the other?

Copy link
Member

Choose a reason for hiding this comment

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

Right so can we simplify it to only check for "SystemOverloadedError"?

def test_pool_backoff_preserves_existing_connections(self):
def test_pool_backpressure_preserves_existing_connections(self):
client = self.rs_or_single_client()
coll = self.db.t
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this line be coll = client.pymongo_test.t? Otherwise we're using two different clients.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

# a closed connection.
# If found, set backoff and add error labels.
# Look for errors of type AutoReconnect and add error labels if appropriate.
if self.is_sdam or type(error) != AutoReconnect:
Copy link
Member

Choose a reason for hiding this comment

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

Since we now want to label NetworkTimeouts on connect as overload, should this be isinstance(error, AutoReconnect)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added NetworkTimeout explicitly

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh good, this caught a logic error in the backoff network timeout test

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.

2 participants