Skip to content

Commit

Permalink
Don't allow the impossible divide-by-zero in bandwidth
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed May 4, 2015
1 parent 49ae455 commit 4092c99
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion transfers.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ def download(
shebang = None
if not tdenv.quiet:
now = time.time()
deltaT = max(now - lastTime, 0.001)
lastTime = now
if len(histogram) >= 15:
histogram.popleft()
histogram.append(len(data) / (now - lastTime))
histogram.append(len(data) / deltaT)
progBar.increment(
len(data),
postfix=lambda value, goal: \
Expand Down

0 comments on commit 4092c99

Please sign in to comment.