From 45fef8109c25c52929d8166f1827217513bcac63 Mon Sep 17 00:00:00 2001 From: Niklas Neugebauer Date: Tue, 3 Dec 2024 15:42:36 +0100 Subject: [PATCH] style: use a for loop --- learning_loop_node/loop_communication.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/learning_loop_node/loop_communication.py b/learning_loop_node/loop_communication.py index 7ca505d..ed804d5 100644 --- a/learning_loop_node/loop_communication.py +++ b/learning_loop_node/loop_communication.py @@ -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