Merge pull request #32 from aduriseti/master

Reduce I/O Cost - no change to ETA algorithm
This commit is contained in:
Georgios Verigakis
2016-10-30 10:25:00 +02:00
committed by GitHub

View File

@@ -66,18 +66,20 @@ class Infinite(object):
pass
def next(self, n=1):
if n > 0:
now = time()
dt = now - self._ts
if dt < self.time_threshold:
self._pending += n
else:
self._xput.append((n + self._pending) / dt)
self._ts = now
self._pending = 0
if n <= 0:
return
now = time()
dt = now - self._ts
if dt < self.time_threshold:
self._pending += n
else:
# avoid performing computationally intensive update task
# more than 1/dt (10 by default) times a second
self._xput.append((self._pending + n) / dt)
self._ts = now
self._pending = 0
self.update()
self.index = self.index + n
self.update()
def iter(self, it):
try: