Skip to content

Commit 9fa8631

Browse files
devin-ai-integration[bot]bot_apk
andcommitted
fix: address Copilot review - format backoff line, rename exception_class to retry_scenario
Co-Authored-By: bot_apk <apk@cognition.ai>
1 parent 241f621 commit 9fa8631

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

airbyte_cdk/sources/streams/http/http_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,11 @@ def _send_with_retry(
298298
)
299299

300300
# User-defined backoff gets +1s to cover fractions; otherwise exponential 2^(n-1)
301-
backoff_seconds = exc.backoff_time + 1 if exc.backoff_time is not None else float(2 ** (attempt - 1))
301+
backoff_seconds = (
302+
exc.backoff_time + 1
303+
if exc.backoff_time is not None
304+
else float(2 ** (attempt - 1))
305+
)
302306

303307
if exc.response is not None and isinstance(exc.response, requests.Response):
304308
self._logger.info(

unit_tests/sources/streams/http/test_http_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ def test_send_request_respects_environment_variables():
805805

806806
@pytest.mark.usefixtures("mock_sleep")
807807
@pytest.mark.parametrize(
808-
"response_code, expected_failure_type, error_message, exception_class",
808+
"response_code, expected_failure_type, error_message, retry_scenario",
809809
[
810810
(400, FailureType.system_error, "test error message", "user_defined"),
811811
(401, FailureType.config_error, "test error message", "user_defined"),
@@ -819,17 +819,17 @@ def test_send_request_respects_environment_variables():
819819
],
820820
)
821821
def test_send_with_retry_raises_airbyte_traced_exception_with_failure_type(
822-
response_code, expected_failure_type, error_message, exception_class, requests_mock
822+
response_code, expected_failure_type, error_message, retry_scenario, requests_mock
823823
):
824-
if exception_class == "user_defined":
824+
if retry_scenario == "user_defined":
825825

826826
class CustomBackoffStrategy:
827827
def backoff_time(self, response_or_exception, attempt_count):
828828
return 0.1
829829

830830
backoff_strategy = CustomBackoffStrategy()
831831
response_action = ResponseAction.RETRY
832-
elif exception_class == "rate_limited":
832+
elif retry_scenario == "rate_limited":
833833
backoff_strategy = None
834834
response_action = ResponseAction.RATE_LIMITED
835835
else:

0 commit comments

Comments
 (0)