Skip to content

Bulk asynchronous downloader for multiple file hosts

Simplify throttle_times key initialization (#436)

Arkadiy Illarionove36ae07ad97d
diff --git a/cyberdrop_dl/client/rate_limiting.py b/cyberdrop_dl/client/rate_limiting.py
index f08e1042f..d2b66a5d9 100644
--- a/cyberdrop_dl/client/rate_limiting.py
+++ b/cyberdrop_dl/client/rate_limiting.py
@@ -70,10 +70,8 @@ async def throttle(self, delay: int, host: str) -> None:
if delay is None or delay == 0:
return
- key: Optional[str] = None
+ key = f'throttle:{host}'
while True:
- if key is None:
- key = f'throttle:{host}'
now = time.time()
last = self.throttle_times.get(key, 0.0)
elapsed = now - last