(fix) cluster: handle None control_connection_timeout in wait_for_schema_agreement#768
Open
(fix) cluster: handle None control_connection_timeout in wait_for_schema_agreement#768
Conversation
…ema_agreement min(self._timeout, total_timeout - elapsed) raises TypeError when control_connection_timeout is set to None, which is explicitly documented as a supported value (meaning no timeout). Guard the min() call so that when self._timeout is None, we use only the remaining schema agreement wait time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TypeErrorinwait_for_schema_agreementwhencontrol_connection_timeoutis set toNonemin(self._timeout, total_timeout - elapsed)call atcluster.py:4120raisesTypeErrorbecausemin()cannot compareNonewith a numeric valuecontrol_connection_timeout=Noneis explicitly documented as supported (meaning "no timeout"), so this is a pre-existing bugChanges
cassandra/cluster.py: Guard themin()call -- whenself._timeout is None, use only the remaining schema agreement wait time instead of callingmin(None, remaining)tests/unit/test_control_connection.py: Addtest_wait_for_schema_agreement_none_timeoutto verify the fixTesting
All 23 unit tests in
test_control_connection.pypass (requires running without the Cython-compiled.soto test pure Python changes):