未验证 提交 8a77e5e6 编写于 作者: P pukkandan

[cleanup] Revert unnecessary changes in 51d9739f

上级 51d9739f
......@@ -14,7 +14,6 @@
format_bytes,
shell_quote,
timeconvert,
ThrottledDownload,
)
......@@ -172,7 +171,7 @@ def write_debug(self, *args, **kargs):
def slow_down(self, start_time, now, byte_counter):
"""Sleep if the download speed is over the rate limit."""
rate_limit = self.params.get('ratelimit')
if byte_counter == 0:
if rate_limit is None or byte_counter == 0:
return
if now is None:
now = time.time()
......@@ -180,7 +179,7 @@ def slow_down(self, start_time, now, byte_counter):
if elapsed <= 0.0:
return
speed = float(byte_counter) / elapsed
if rate_limit is not None and speed > rate_limit:
if speed > rate_limit:
sleep_time = float(byte_counter) / rate_limit - elapsed
if sleep_time > 0:
time.sleep(sleep_time)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册