Skip to content

Commit b2a98db

Browse files
author
alex-omophub
committed
Refactor retry condition formatting in SyncHTTPClient and AsyncHTTPClientImpl
1 parent 05df251 commit b2a98db

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/omophub/_http.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ def request(
138138
json=json,
139139
)
140140
# Retry on server errors (502, 503, 504)
141-
if response.status_code in (502, 503, 504) and attempt < self._max_retries:
141+
if (
142+
response.status_code in (502, 503, 504)
143+
and attempt < self._max_retries
144+
):
142145
time.sleep(2**attempt * 0.5)
143146
continue
144147
return response.content, response.status_code, response.headers
@@ -227,7 +230,10 @@ async def request(
227230
json=json,
228231
)
229232
# Retry on server errors (502, 503, 504)
230-
if response.status_code in (502, 503, 504) and attempt < self._max_retries:
233+
if (
234+
response.status_code in (502, 503, 504)
235+
and attempt < self._max_retries
236+
):
231237
await asyncio.sleep(2**attempt * 0.5)
232238
continue
233239
return response.content, response.status_code, response.headers

0 commit comments

Comments
 (0)