Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8244282

Browse files
author
Clayton Walker
committed
Add ChunkedEncodingError to list of retryable exceptions
1 parent5370979 commit8244282

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

‎gitlab/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ def http_request(
694694
stream=streamed,
695695
**opts,
696696
)
697-
exceptrequests.ConnectionError:
697+
except(requests.ConnectionError,requests.exceptions.ChunkedEncodingError):
698698
ifretry_transient_errorsand (
699699
max_retries==-1orcur_retries<max_retries
700700
):

‎tests/unit/test_gitlab_http_methods.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,37 @@ def request_callback(request):
129129
assertlen(responses.calls)==calls_before_success
130130

131131

132+
@responses.activate
133+
deftest_http_request_with_retry_on_method_for_transient_network_failures_chunked(gl):
134+
call_count=0
135+
calls_before_success=3
136+
137+
url="http://localhost/api/v4/projects"
138+
139+
defrequest_callback(request):
140+
nonlocalcall_count
141+
call_count+=1
142+
status_code=200
143+
headers= {}
144+
body="[]"
145+
146+
ifcall_count>=calls_before_success:
147+
return (status_code,headers,body)
148+
raiserequests.exceptions.ChunkedEncodingError("todo")
149+
150+
responses.add_callback(
151+
method=responses.GET,
152+
url=url,
153+
callback=request_callback,
154+
content_type="application/json",
155+
)
156+
157+
http_r=gl.http_request("get","/projects",retry_transient_errors=True)
158+
159+
asserthttp_r.status_code==200
160+
assertlen(responses.calls)==calls_before_success
161+
162+
132163
@responses.activate
133164
deftest_http_request_with_retry_on_class_for_transient_failures(gl_retry):
134165
call_count=0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp