Skip to content

Commit 8543c04

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 817ed9a commit 8543c04

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
@@ -5270,10 +5270,7 @@ def _set_result(self, host, connection, pool, response):
52705270
log.warning("Host %s truncate error: %s.", host, response.summary)
52715271
if self._metrics is not None:
52725272
self._metrics.on_other_error()
5273-
if hasattr(response, 'to_exception'):
5274-
self._set_final_exception(response.to_exception())
5275-
else:
5276-
self._set_final_exception(response)
5273+
self._set_final_exception(response.to_exception())
52775274
return
52785275
elif isinstance(response, PreparedQueryNotFound):
52795276
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)