Skip to content

Commit 9222b2e

Browse files
Copilotmykaul
andcommitted
Address code review feedback - simplify to_exception call and clarify test comment
Co-authored-by: mykaul <4655593+mykaul@users.noreply.github.com>
1 parent ddb1e91 commit 9222b2e

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

cassandra/cluster.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4789,10 +4789,7 @@ def _set_result(self, host, connection, pool, response):
47894789
log.warning("Host %s truncate error: %s.", host, response.summary)
47904790
if self._metrics is not None:
47914791
self._metrics.on_other_error()
4792-
if hasattr(response, 'to_exception'):
4793-
self._set_final_exception(response.to_exception())
4794-
else:
4795-
self._set_final_exception(response)
4792+
self._set_final_exception(response.to_exception())
47964793
return
47974794
elif isinstance(response, PreparedQueryNotFound):
47984795
if self.prepared_statement:

tests/integration/simulacron/test_policies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def test_retry_policy_on_request_error(self):
443443

444444
assert len(rf.attempted_hosts) == 1 # no retry
445445

446-
assert next(retry_policy.request_error) == 3
446+
assert next(retry_policy.request_error) == 3 # 3 calls (excludes TruncateError)
447447

448448
# Test TruncateError is not retried (no on_request_error call)
449449
clear_queries()

0 commit comments

Comments
 (0)