Download fixes
- don't make empty requests - don't make requests if all objects are pending already
This commit is contained in:
parent
57c8c7c07c
commit
053f434e04
|
@ -62,6 +62,8 @@ class DownloadThread(threading.Thread, StoppableThread):
|
|||
continue
|
||||
payload.extend(chunk)
|
||||
missingObjects[chunk] = now
|
||||
if not payload:
|
||||
continue
|
||||
i.append_write_buf(protocol.CreatePacket('getdata', payload))
|
||||
logger.debug("%s:%i Requesting %i objects", i.destination.host, i.destination.port, len(request))
|
||||
requested += len(request)
|
||||
|
|
|
@ -71,8 +71,9 @@ class RandomTrackingDict(object):
|
|||
self.pendingTimeout = pendingTimeout
|
||||
|
||||
def randomKeys(self, count=1):
|
||||
if self.len == 0 or (self.pendingLen >= self.maxPending and
|
||||
self.lastPoll + self.pendingTimeout > time()):
|
||||
if self.len == 0 or ((self.pendingLen >= self.maxPending or
|
||||
self.pendingLen == self.len) and self.lastPoll +
|
||||
self.pendingTimeout > time()):
|
||||
raise KeyError
|
||||
# reset if we've requested all
|
||||
with self.lock:
|
||||
|
|
Loading…
Reference in New Issue
Block a user