From c3939875d3bc1df8ea967131a6d1c32a956072bc Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Tue, 1 Jan 2019 21:18:05 +0100 Subject: [PATCH] Fix repeated downloads - a bug in RandomTrackingDict caused requesting to download the same objects over and over - the bug is that the lastObject wasn't properly initalised, this caused the write buffer to fill with "getdata" requests until the first object was received - this PR should address both the excessive bandwidth as well as excessive CPU usage during downloading --- src/randomtrackingdict.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/randomtrackingdict.py b/src/randomtrackingdict.py index 4d85708f..431e75d3 100644 --- a/src/randomtrackingdict.py +++ b/src/randomtrackingdict.py @@ -111,6 +111,7 @@ class RandomTrackingDict(object): # or if last object received too long time ago if self.pendingLen == self.len or self.lastObject + self.pendingTimeout > time(): self.pendingLen = 0 + self.setLastObject() available = self.len - self.pendingLen if count > available: count = available