-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-5517 Simplify pool backpressure behavior #2611
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
base: backpressure
Are you sure you want to change the base?
Conversation
| class PyMongoBaseProtocol(Protocol): | ||
| def __init__(self, timeout: Optional[float] = None): | ||
| self.transport: Transport = None # type: ignore[assignment] | ||
| self._timeout = timeout |
There was a problem hiding this comment.
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
| "SystemOverloadedError" | ||
| if isinstance(error, WaitQueueTimeoutError) or ( | ||
| error.has_error_label("SystemOverloadedError") | ||
| and error.has_error_label("RetryableError") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"?
test/test_pooling.py
Outdated
| 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pymongo/asynchronous/pool.py
Outdated
| # 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: |
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added NetworkTimeout explicitly
There was a problem hiding this comment.
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
Replaces #2598