Skip to content

Commit

Permalink
style: use a for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasNeugebauer committed Dec 3, 2024
1 parent 1011b1e commit 45fef81
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions learning_loop_node/loop_communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
def retry_on_429(func: Callable[..., Awaitable]) -> Callable[..., Awaitable]:
"""Decorator that retries requests that receive a 429 status code."""
async def wrapper(*args, **kwargs) -> httpx.Response:
retries = 0
while retries < MAX_RETRIES_ON_429:
for _ in range(MAX_RETRIES_ON_429):
response = await func(*args, **kwargs)
if response.status_code != 429:
return response

retries += 1
await asyncio.sleep(SLEEP_TIME_ON_429)

return response
Expand Down

0 comments on commit 45fef81

Please sign in to comment.