Download queue log messages now skip-based x10

fixes #31
master
Kevin Froman 2019-08-13 04:16:11 -05:00
parent 9601a3d072
commit 795266edaf
1 changed files with 6 additions and 1 deletions

View File

@ -28,7 +28,10 @@ def download_blocks_from_communicator(comm_inst):
assert isinstance(comm_inst, communicator.OnionrCommunicatorDaemon) assert isinstance(comm_inst, communicator.OnionrCommunicatorDaemon)
blacklist = onionrblacklist.OnionrBlackList() blacklist = onionrblacklist.OnionrBlackList()
storage_counter = storagecounter.StorageCounter() storage_counter = storagecounter.StorageCounter()
LOG_SKIP_COUNT = 10
count = 0
for blockHash in list(comm_inst.blockQueue): for blockHash in list(comm_inst.blockQueue):
count += 1
if len(comm_inst.onlinePeers) == 0: if len(comm_inst.onlinePeers) == 0:
break break
triedQueuePeers = [] # List of peers we've tried for a block triedQueuePeers = [] # List of peers we've tried for a block
@ -112,7 +115,9 @@ def download_blocks_from_communicator(comm_inst):
if removeFromQueue: if removeFromQueue:
try: try:
del comm_inst.blockQueue[blockHash] # remove from block queue both if success or false del comm_inst.blockQueue[blockHash] # remove from block queue both if success or false
if count == LOG_SKIP_COUNT:
logger.info('%s blocks remaining in queue' % [len(comm_inst.blockQueue)], terminal=True) logger.info('%s blocks remaining in queue' % [len(comm_inst.blockQueue)], terminal=True)
count = 0
except KeyError: except KeyError:
pass pass
comm_inst.currentDownloading.remove(blockHash) comm_inst.currentDownloading.remove(blockHash)