From 795266edaf11566598716d77c841516e7a2e24c2 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Tue, 13 Aug 2019 04:16:11 -0500 Subject: [PATCH] Download queue log messages now skip-based x10 fixes #31 --- onionr/communicatorutils/downloadblocks/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/onionr/communicatorutils/downloadblocks/__init__.py b/onionr/communicatorutils/downloadblocks/__init__.py index 60a4ed4b..2c20a3c1 100755 --- a/onionr/communicatorutils/downloadblocks/__init__.py +++ b/onionr/communicatorutils/downloadblocks/__init__.py @@ -28,7 +28,10 @@ def download_blocks_from_communicator(comm_inst): assert isinstance(comm_inst, communicator.OnionrCommunicatorDaemon) blacklist = onionrblacklist.OnionrBlackList() storage_counter = storagecounter.StorageCounter() + LOG_SKIP_COUNT = 10 + count = 0 for blockHash in list(comm_inst.blockQueue): + count += 1 if len(comm_inst.onlinePeers) == 0: break triedQueuePeers = [] # List of peers we've tried for a block @@ -112,7 +115,9 @@ def download_blocks_from_communicator(comm_inst): if removeFromQueue: try: del comm_inst.blockQueue[blockHash] # remove from block queue both if success or false - logger.info('%s blocks remaining in queue' % [len(comm_inst.blockQueue)], terminal=True) + if count == LOG_SKIP_COUNT: + logger.info('%s blocks remaining in queue' % [len(comm_inst.blockQueue)], terminal=True) + count = 0 except KeyError: pass comm_inst.currentDownloading.remove(blockHash)