Logic error in download reset

- fix requesting the same object over and over again, now it continues to
  iterate through the other objects and only resets the queue after a timeout
  after the last received object
This commit is contained in:
Peter Šurda 2019-01-02 22:25:25 +01:00
parent c3939875d3
commit 4ad6401449
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -108,8 +108,8 @@ class RandomTrackingDict(object):
# pylint: disable=redefined-outer-name # pylint: disable=redefined-outer-name
with self.lock: with self.lock:
# reset if we've requested all # reset if we've requested all
# or if last object received too long time ago # and if last object received too long time ago
if self.pendingLen == self.len or self.lastObject + self.pendingTimeout > time(): if self.pendingLen == self.len and self.lastObject + self.pendingTimeout > time():
self.pendingLen = 0 self.pendingLen = 0
self.setLastObject() self.setLastObject()
available = self.len - self.pendingLen available = self.len - self.pendingLen